On Sun, Jan 23, 2005 at 11:13:05AM -0800, Linus Torvalds wrote:
> 
> 
> On Sun, 23 Jan 2005, Randy.Dunlap wrote:
> >
> > I had proposed a kernel patch to TASK_SIZE on x86_64 to
> > eliminate 3,214 (!) sparse warnings in 2.6.11-rc2, but
> > Andi thinks this is a sparse (data type) bug.  Comments?
> 
> It's not a sparse bug - sparse correctly notices that the constant is
> "long", and it very much on purpose warns about it. A lot of people don't
> know what the conversion rules for big constants are (they are _different_
> from all other conversion rules, and as an example, hex constants act
> differently from decimal constants).
> 
> So the warning is the same kind of warning as "don't use assignments in 
> logical expression" - the code isn't wrong per se, but the code is 
> definitely open to surprising behaviour.

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.

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? 

-Andi
-
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

Reply via email to