lkml.org 
[lkml]   [1999]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Q: void* vs. unsigned long (fwd)

    On Tue, 16 Feb 1999, John Cochran wrote:

    > 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):

    A dictionnary should be enough. I understand that they must be considered
    as strictly ordered even on target where some have same representation.

    In other words:

    - Never assume that 2 of them have the same representation if you want to
    write portable C code.
    - A nice compiler will warn you when your code seems to assume such thing,
    even if the target platform has actually same representation for the 2
    types.

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

    Apply these sentences to army, and if it still isn't clear, then
    learn French language. ;-)

    > 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

    I donnot remember 'int' to ever have been 16 bits large on real
    machines. Is this spec. that old? ;-)

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

    Example on GCOS8:

    char 9 bits
    short 36 bits (optionnally 18 bits)
    int 36 bits
    long 36 bits

    Seems both Bill and Bull are still compliant to C, btw. :-)

    > John Cochran

    Gérard Roudier.


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

    \
     
     \ /
      Last update: 2005-03-22 13:50    [W:0.036 / U:2.352 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site