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

Richard legalize at xmission.com
Wed Nov 13 14:47:00 PST 2013


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.

A more interesting question would be what happens to ~0....
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>



More information about the cfe-dev mailing list