Std's 6.3- conversion- term rank

Discussion in 'C Programming' started by dam_fool_2003@yahoo.com, Jul 25, 2004.

  1. Guest

    Just now I asked a question about signed char and unsigned char. I had the
    replay very fast by jens.torring and Tim prince. I post via google so now
    goes my thanking replay. (I must be more precise according to jens.torring's
    replay)

    As I was reading the slandered draft C99 about the conversion (6.3)
    I have interpreted the word conversion rank as the range of a variable
    (as per defined in limits.h). Am I wrong in my understanding?

    (I went through FAQ and I don't find the correct spot)
     
    , Jul 25, 2004
    #1
    1. Advertising

  2. Jack Klein Guest

    On 25 Jul 2004 09:48:42 -0700, wrote in
    comp.lang.c:

    > Just now I asked a question about signed char and unsigned char. I had the
    > replay very fast by jens.torring and Tim prince. I post via google so now
    > goes my thanking replay. (I must be more precise according to jens.torring's
    > replay)
    >
    > As I was reading the slandered draft C99 about the conversion (6.3)

    ^^^^^^^^^

    Slandered?

    > I have interpreted the word conversion rank as the range of a variable
    > (as per defined in limits.h). Am I wrong in my understanding?
    >
    > (I went through FAQ and I don't find the correct spot)


    No, the conversion rank has nothing at all to do with the range of a
    type.

    It specifically says this in the actual standard:

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

    It cannot be by range of values, because it is quite common for two or
    more different integer types to have the same bit-width and value
    range on many implementations.

    On 16-bit implementations, short and int usually have the same range.

    On today's common 32-bit desk-top systems, int and long usually have
    the same range.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Jul 25, 2004
    #2
    1. Advertising

  3. "Jack Klein" <> wrote in message
    news:...
    > On 25 Jul 2004 09:48:42 -0700, wrote in
    > comp.lang.c:
    >
    > > Just now I asked a question about signed char and unsigned char. I had

    the
    > > replay very fast by jens.torring and Tim prince. I post via google so

    now
    > > goes my thanking replay. (I must be more precise according to

    jens.torring's
    > > replay)
    > >
    > > As I was reading the slandered draft C99 about the conversion (6.3)

    > ^^^^^^^^^
    > Slandered?
    >
    > > I have interpreted the word conversion rank as the range of a

    variable
    > > (as per defined in limits.h). Am I wrong in my understanding?
    > >
    > > (I went through FAQ and I don't find the correct spot)

    >
    > No, the conversion rank has nothing at all to do with the range of a
    > type.


    Nothing at all?!

    > It specifically says this in the actual standard:
    >
    > "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 sentence before that is...

    - The rank of a signed integer type shall be greater than the rank
    of any signed integer type with less precision.

    Later, 6.2.5p8 says...

    For any two integer types with the same signedness and different
    integer conversion rank (see 6.3.1.1), the range of values of the
    type with smaller integer conversion rank is a subrange of the
    values of the other type.

    The concepts of range and rank are inextricably linked.

    --
    Peter
     
    Peter Nilsson, Jul 26, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page