[cfe-dev] Error when testing clang with VC++ RTL and Boost MPL

Edward Diener eldlistmailingz at tropicsoft.com
Wed Nov 13 15:00:13 PST 2013


On 11/13/2013 5:47 PM, Richard wrote:
>
> In article <CAOfiQq=_WFp2pX4G1tD6=2OZp_HsyYFyW4u34Kv=u4kW7uzMbw at mail.gmail.com>,
>      Richard Smith <richard at metafoo.co.uk> writes:
>
>> On Wed, Nov 13, 2013 at 1:58 PM, Edward Diener <
>>> This I do not understand. Why does 0xffffffff evaluate to 4294967295
>>> rather than -1 ? Where in the C++ standard does it say that hex literals
>>> are unsigned values by default ?
>>
>> 2.14.2/2
>
> To clarify: it's not the 0x that turns it into unsigned, it's that the
> quantity 0xffffffff cannot be represented as a 32-bit signed integer
> because it specifies 32-bits worth of 1's, but it does fit into a
> 32-bit unsigned integer, so that's what the compiler uses.

Why is not 0xffffffff equal to -1 as a 32-bit signed integer ? Something 
seems really strange if that is not the case.





More information about the cfe-dev mailing list