Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c > #6125

Problem with ranks

Path csiph.com!aioe.org!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx27.am4.POSTED!not-for-mail
From Spiros Bousbouras <spibou@gmail.com>
Newsgroups comp.std.c
Subject Problem with ranks
Message-ID <ym86jKAqoCXFYStC@bongo-ra.co> (permalink)
X-Organisation Weyland-Yutani
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 8bit
Lines 24
X-Complaints-To http://netreport.virginmedia.com
NNTP-Posting-Date Sat, 30 May 2020 01:55:46 UTC
Organization virginmedia.com
Date Sat, 30 May 2020 01:55:46 GMT
X-Received-Bytes 1597
X-Received-Body-CRC 538847154
Xref csiph.com comp.std.c:6125

Show key headers only | View raw


Assume an implementation with 2 extended integer types as follows :

- INT1 is signed , has 23 value bits and no corresponding unsigned type.
- UINT1 is unsigned , has 40 value bits and no corresponding signed type.
- Both have rank greater than  int .
- The rank of UINT1 is smaller than the rank of INT1 .

The last stipulation is perverse but I don't see anything in "6.3.1.1
Boolean, characters, and integers" which forbids it.

With the above , if you have an addition where one operand is of type INT1
and the other of type UINT1 then none of the possibilities (rules) in
"6.3.1.8 Usual arithmetic conversions"  after the part  "Otherwise, the integer
promotions are performed on both operands. Then the following rules are
applied to the promoted operands:"  is applicable. This even if we assume that
ranks are always comparable which isn't clear.

So I think that the following rule should be added to 6.3.1.1 :

   The rank of an integer type shall be greater or equal than the rank of any
   integer type with less or equal precision.

-- 
vlaho.ninja/prog

Back to comp.std.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Problem with ranks Spiros Bousbouras <spibou@gmail.com> - 2020-05-30 01:55 +0000
  Re: Problem with ranks James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-30 02:48 -0400
    Re: Problem with ranks Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-05-30 02:18 -0700
      Re: Problem with ranks jameskuyper@alumni.caltech.edu - 2020-05-30 07:11 -0700
        Re: Problem with ranks Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-06-28 05:54 -0700
    Re: Problem with ranks James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-30 09:04 -0400
  Re: Problem with ranks Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-05-30 02:11 -0700

csiph-web