Re: [C++0x] code that used to be accepted isn't accepted anymore (related to constexpr changes?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 6, 2010 at 7:47 PM, ZdenÄk Sojka <zsojka@xxxxxxxxx> wrote:
>
>> The compiler is right: the value of `x' cannot fit in an int, therefore the
>> declaration is ill-formed. ÂThis has nothing to do with constexpr.
>
> (-1) isn't representible in unsigned as well, but I suppose I should read the c++0x "standard" then, thanks :)

That is a common misconception: (-1) is a perfectly valid unsigned int
value, it is the maximum
value of type unsigned int.  That is precisely why it cannot be
represented by int and
why the compiler is yelling.  Don't allow yourself to be confused by the syntax.

-- Gaby



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux