Re: Typedefs / gcc / HIGHMEM

H. Peter Anvin (hpa@zytor.com)
8 Dec 2001 15:40:24 -0800


Followup to: <200112081838.TAA19684@webserver.ithnet.com>
By author: Stephan von Krawczynski <skraw@ithnet.com>
In newsgroup: linux.dev.kernel
>
> if (tp->rx_buffers[entry].mapping !=
> le32_to_cpu(tp->rx_ring[entry].buffer1)) {
>
> The first is u64, the second u32. Either the u64 value is not
> required, or the statement is broken. Astonishing there is _no_
> compiler warning in this line.
>

Why should there be? The u32 value gets promoted to u64 before the
comparison is done.

> BTW, my personal opinion to "typedef unsigned int u32" is that it
> should rather be "typedef unsigned long u32", but this is religious.

I see you have a background in environments where you move between 16-
and 32-bit machines. Guess what, in Linux the major movement is
between 32- and 64-bit machines, and "unsigned int" is consistent,
whereas "unsigned long" isn't (long is 32 bits on 32-bit machines, 64
bits on 64-bit machines.)

-hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/