>> It may be fixed now, but there was a time when long literals without
>> the L were quietly truncated on the high end.
>
> It was fixed in about 1998.
Nevertheless, Rudy's right that one should use the L for long literals. This
is especially true for values near (long) INT_MAX or (long) INT_MIN. But why
try to remember when you must use 'L' and when it's optional, or force code
maintainers to? Just use it whenever you intend a long literal.

Signature
Lew
Andrew Thompson - 14 Sep 2007 14:04 GMT
>Nevertheless, Rudy's ..
<grin>
Eye Haight spell chequers.
</grin>

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Lew - 14 Sep 2007 14:35 GMT
>> Nevertheless, Rudy's ..
>
> <grin>
> Eye Haight spell chequers.
> </grin>
Yes, I am really, really, really sorry about that.

Signature
Lew
>> It may be fixed now, but there was a time when long literals without
>> the L were quietly truncated on the high end.
>
> It was fixed in about 1998.
Nevertheless, Roedy's right that one should use the L for long literals. This
is especially true for values near (long) INT_MAX or (long) INT_MIN. But why
try to remember when you must use 'L' and when it's optional, or force code
maintainers to? Just use it whenever you intend a long literal.

Signature
Lew
My first, now canceled, post of this message misspelled Roedy's name. I'm
sorry, Roedy. I was thinking the right way, but typed the wrong way.
Esmond Pitt - 14 Sep 2007 13:56 GMT
> Nevertheless, ... one should use the L for long literals.
as the compiler has been forcing you to do since 1998.
Roedy Green - 15 Sep 2007 20:28 GMT
>Nevertheless, Roedy's right that one should use the L for long literals. This
>is especially true for values near (long) INT_MAX or (long) INT_MIN.
The problem I get nailed on every once is a while is comparing
Integer.MAX_VALUE. As soon as you start doing arithmetic or
comparisons in values in that range, cast to longs, on use
MAX_VALUE/2 if all you wanted was "a very large value, larger than any
that would occur in "nature""

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com