Ran Berenfeld wrote:
well ...no... first evaluate, then assign. and constants are int by default.
I think C/C++ would have the same problem...

Maybe. But then why does the fact of specifying just the first right-hand side constant in the calculation as a long, magically change the whole result into a long ?
(1000 * 60 * 60 * 24 * 365)  --> int
(1000L * 60 * 60 * 24 * 365) --> long

Note: my intention is not to start a rant or a flame on the way Java does 
things.
I suppose that the Java syntax rules describe this accurately.
But I find this unintuitive.
Specially since it appears that in your first formula, the result is overflowing at some point in the calculation, without even a warning (?).

If someone writes
Long a = something
then someone clearly expresses the desire to obtain a Long result.
And if for some obscure reason that was really not the case, one could always 
write
Long a = (int) something

I suppose that there must be some implacable logic in the way it's done now, other than the evil intention to fool the unsuspecting programmer, but I honestly fail to see it.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to