Std's 6.3- conversion- term rank

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dam_fool_2003@yahoo.com

    Std's 6.3- conversion- term rank

    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)
  • Jack Klein

    #2
    Re: Std's 6.3- conversion- term rank

    On 25 Jul 2004 09:48:42 -0700, dam_fool_2003@y ahoo.com wrote in
    comp.lang.c:
    [color=blue]
    > 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)[/color]
    ^^^^^^^^^

    Slandered?
    [color=blue]
    > 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)[/color]

    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.l earn.c-c++

    Comment

    • Peter Nilsson

      #3
      Re: Std's 6.3- conversion- term rank

      "Jack Klein" <jackklein@spam cop.net> wrote in message
      news:5hd8g098up pe1l4i63jjjj0t6 rupmrr2pf@4ax.c om...[color=blue]
      > On 25 Jul 2004 09:48:42 -0700, dam_fool_2003@y ahoo.com wrote in
      > comp.lang.c:
      >[color=green]
      > > Just now I asked a question about signed char and unsigned char. I had[/color][/color]
      the[color=blue][color=green]
      > > replay very fast by jens.torring and Tim prince. I post via google so[/color][/color]
      now[color=blue][color=green]
      > > goes my thanking replay. (I must be more precise according to[/color][/color]
      jens.torring's[color=blue][color=green]
      > > replay)
      > >
      > > As I was reading the slandered draft C99 about the conversion (6.3)[/color]
      > ^^^^^^^^^
      > Slandered?
      >[color=green]
      > > I have interpreted the word conversion rank as the range of a[/color][/color]
      variable[color=blue][color=green]
      > > (as per defined in limits.h). Am I wrong in my understanding?
      > >
      > > (I went through FAQ and I don't find the correct spot)[/color]
      >
      > No, the conversion rank has nothing at all to do with the range of a
      > type.[/color]

      Nothing at all?!
      [color=blue]
      > 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'."[/color]

      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


      Comment

      Working...