Will there be a 5.3.1?
Pete French
petefrench at ticketswitch.com
Wed Dec 22 04:26:14 PST 2004
> Buggy compilers are indefensible, yes, but why try to apologise for it?
I dont see it as a bug. Without an 'L' the right hand side of that
expression is a 16 bit int. For which 65536 is out of range. If I
wrote 'int y = 65535; long x = y;' then I would get the same result for
the same reason.
The correct line is 'long x = 65535L;' which specifies that the constant
is a long. In fact aren't situations like this the precise reason for
having the 'L' as part of the language ?
> 'long x = 65535;' will not set x to -1, even with 16-bit ints.
It will and does on certain compilers unfortunately.
-pcf.
More information about the freebsd-stable
mailing list