Integral conversions in C/C++

Andrew Haley aph@redhat.com
Mon Apr 21 11:48:00 GMT 2008


Christian Böhme wrote:
> Andrew Haley wrote:
> 
>>>> What type is the expression -(b * 2u)?
> 
>> The correct answer is unsigned int.
> 
> Here's the question: Why ?  And by which logic ?

Because the standard says so.

>> Please read C99 Section 6.3.1.1 Para 2, and Section 6.3.1.8.
> 
> Care to point to the appropriate sections in the C++ standard ?

Section 5 Para. 9 and Section 4.5.  The language is copied
from the C Standard.

Andrew.



More information about the Gcc-help mailing list