too many warnings
Martin von Loewis
martin@mira.isdn.cs.tu-berlin.de
Sat Oct 31 10:27:00 GMT 1998
> The warning is correct, your code is incorrect; you failed to
> indicate, that the numeric literal is 'unsigned' by appending a 'U'.
To further support this claim, I quote from the C++ standard,
[lex.icon]/2
>> The type of an integer literal depends on its form, value, and
>> suffix. If it is decimal and has no suffix, it has the first of
>> these types in which its value can be represented: int, long int;
>> if the value cannot be repreÃÂsented as a long int, the behavior is
>> undefined.
Since long can represent 2**31 at most on the architecture you are
using, the behaviour of your program is undefined (I assume a similar
statement holds for in standard C).
g++ accepts this program, anyway; it supports representing your number
as an unsigned int. Since this is an extension, it must be diagnosed
by a standards compliant compiler.
As Manfred points out, you can fix it by appending 'U'. Alternatively,
could could write it in hex or oct.
Hope this helps,
Martin
More information about the Gcc-bugs
mailing list