Re: Q: void* vs. unsigned long (fwd)

John Cochran (kernel@fiawol.org)
Tue, 16 Feb 1999 14:13:10 -0500 (EST)


Matti Aarnio <matti.aarnio@sonera.fi> wrote:
> Jakub Jelinek <jj@sunsite.mff.cuni.cz> wrote:
> ...
> > 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.
>
> Interesting, so this tells that:
>
> rank(long long int) > rank(long int) > rank(int) > rank(short int) > rank(char)
>
> While following was the previous definition:
>
> rank(long long int) >= rank(long int) >= rank(int) >= rank(short int) >= rank(char)
>
>
> Systems do exist where *all* of those have same size, but they are
> usually programmed in Fortran-9X, require liquid cooling, and recognize
> name "Cray" ...

I don't see a precise definition of "rank", but I do see that there is a bit
of confusion about "rank" vs. "size". To quote from 6.3.1.1 (not 6.2.1.1):

-- No two signed integer types shall have the same rank, even if they have
the same representation.
-- 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.

The 1st bullet indicates that rank is independant of representation and if
you look at the definitions within <limits.h> (5.2.4.2.1) you'll see that
signed char is at least 8 bits long
short int is at least 16 bits long
int is at least 16 bits long
long is at least 32 bits long
long long is at least 64 bits long

There is no prohibition against all of the integer types being the same length
as long as the minimum requirements are meet.

John Cochran

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