C++ Logo

std-discussion

Advanced search

Re: Did the standard committee vote to make integer comparisons do the right thing?

From: Brian Bi <bbi5291_at_[hidden]>
Date: Wed, 6 Nov 2019 16:37:59 -0600
On Wed, Nov 6, 2019 at 4:31 PM Thiago Macieira via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> On Wednesday, 6 November 2019 14:21:29 PST Brian Bi via Std-Discussion
> wrote:
> > On March 13, 2018, I was told that the standard committee voted
> 5/17/5/4/0
> > to make integer comparisons do the right thing, e.g., `-1 < 0U` will
> become
> > true, whereas in C++17, it is false thanks to the "usual arithmetic
> > conversions"
>
> How about:
> -1 < 2147483648U
>
> Is that true or false?
>
> Please don't say "promote to 64-bit" because that immediately triggers
> asking
> about
> -1 < UINT64_C(9223372036854775808)
>

The version of the story I heard is that if there's no type that can
represent all values of both types being compared, then the comparison
still has to yield the correct result, even though it might be "slow".

Note that I am not making a proposal here; I just want to know whether or
not it's true that said proposal was already made and accepted.


>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel System Software Products
>
>
>
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>


-- 
*Brian Bi*

Received on 2019-11-06 16:40:29