Re: Q: void* vs. unsigned long

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Tue, 16 Feb 1999 08:47:28 +0100 (CET)


>
>
> On 16-Feb-99 Brian Gerst wrote:
> > I thought it was int that changed with the word size of the
> > architecture, not long. Most C books I've seen said long is always 32
> > bits regardless of the word size.
>
> Throw them away.
>
> long is defined to be the longest integer type, long enough to hold any other
> integer value (which is why "long long" is inherently broken). Casting between
> void * and long is never portable, but a compiler implementer would be a fool
> to break it.

long long is defined in ISO C9X, your above definition is no longer true.

C9X clearly states in 6.2.1.1:

- The rank of long long int shall be greater than the
rank of long int, which shall be greater than the rank
of int, which shall be greater than the rank of short
int, which shall be greater than the rank of signed
char.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.2.1 on a sparc64 machine (3958.37 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/