On Sun, 23 Jan 2005, Andi Kleen wrote:
>
> Not sure what surprising behaviour you mean - it should be clear
> to everybody that 0x8000000000000 can only be a 64bit or long long or
> long on 64bit constant.
If you count the zeroes, yes. Me, if it's more than 5 or so digits, I have
a hard time distinguishing them without thinking about it.
And what about a number that looks very similar: 0x80000000. What do you
think that one is? Or the same number written a different way: 2147483648.
Hint: one of them is "long". The other is not. One of them
is unsigned, the other is not.
In fact, on a 32-bit machine, the types of those two _differ_ between C90
and C99. Can you tell me how.
And don't tell me you can count zeroes without thinking about it. A week
ago, there was a bug between because a 0xffffe000 was written as
0xfffe000. And that's just a matter of 3 vs 4 "f"'s.
> I doubt there is significantconfusion even with newbie C programmers about
> this.
>
> Perhaps you mean the signed/unsigned promotion. I can see this being
> a trap for some people, but how about only warning about this, but
> not when using clear >32bit constants?
If it's so clearly a >32bit constant, why not just make it explicit?
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html