Thoughts on unified integer literal improvements
Weijun Wang
Weijun.Wang at Sun.COM
Mon Jun 29 02:56:53 PDT 2009
> long ell = 0xFFFFFFFFu; // A positive long value
Any particular requirement here? Why not simply
long ell = 0xFFFFFFFFl;
>
> I think this approach has some advantages over the "y" suffix; in
> particular I think it gives more desirable behavior in cases like this:
>
> byte b = 0xFFy // a negative byte value
> byte b = 0xFFu // also a negative byte value
>
> short s = 0xFFy // a negative short value, -128;
> // byte value is signed extended
> short s = 0xFFu // a positive short value, +127
>
> int i = 0xFFy // -128
> int i = 0xFFu // 127
Does this mean the actual value of 0xFFu is determined by looking at the
LHS of the assignment? This is terrible.
I'd rather use something like 0bXX which is itself always a byte literal.
Max
>
> -Joe
>
More information about the coin-dev
mailing list