"sparse" warnings..

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon May 3 13:21:21 EST 2004


On Mon, 2004-05-03 at 13:05, Benjamin Herrenschmidt wrote:

> > Quiz: what's the difference between
> >
> > 	#define MIN_INT	0x80000000
> > 	#define MIN_INT 2147483648
> >
> > in C for a 64-bit compiler? Hint: one is "unsigned int", the other is
> > "long".
>
> First one gets zero extended, second one gets sign extended I suppose,
> this first on is bogus.

Hrm... I'm now not even sure I'm not full of shit on that one ;) I admit
I'm not sure how the compiler will deal with the constant. The first one
beeing unsigned int, it may actually be sign extended properly when
casted to int, though the second oen I don't know. I don't know what
will happen when comparing with an int. I would have written the
constant with a sign in the first place ;)


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list