markg@well.UUCP (Mark Grand) (05/21/89)
The current draft of the standard does not require that the sizeof short is less than or equal to the sizeof int; nor that sizeof int is less than or equal to sizeof long. Does anyone know if this was a deliberate or acidental omission?
rex@aussie.UUCP (Rex Jaeschke) (05/22/89)
> The current draft of the standard does not require that the sizeof short is > less than or equal to the sizeof int; nor that sizeof int is less than or > equal to sizeof long. This is one of those "by a careful reading of the draft" type questions. Page 23 lines 36-43 states that "... the range of values of each type [signed char, short, int, long] is a subrange of the values of the next type in the list." Page 24 line 2 requires unsigned versions to have the same size as signed counterparts. Certainly, the situation with the fp types is far more obvious in lines 10-11. Rex ---------------------------------------------------------------------------- Rex Jaeschke | C Users Journal | Journal of C Language Translation (703) 860-0091 | DEC PROFESSIONAL |1810 Michael Faraday Drive, Suite 101 uunet!aussie!rex | Programmers Journal | Reston, Virginia 22090, USA ----------------------------------------------------------------------------
minow@mountn.dec.com (Martin Minow) (05/22/89)
In article <19.UUL1.3#5077@aussie.UUCP> rex@aussie.UUCP (Rex Jaeschke) replies to a posting that noted that the Draft standard "does not require that the sizeof short is less than or equal to the sizeof int..." > >This is one of those "by a careful reading of the draft" type >questions. Page 23 lines 36-43 states that "... the range of values of >each type [signed char, short, int, long] is a subrange of the values >of the next type in the list." Not to be picky, but the *range* of a value is not necessarily the same thing as its storage requirement. For example, on a Vax computer, float and double have the same range, but different size (and different precision). Or, am I reading the standard *too* carefully? Martin Minow minow%thundr.dec@decwrl.dec.com The above does not represent the position of Digital Equipment Corporation.
gwyn@smoke.BRL.MIL (Doug Gwyn) (05/22/89)
In article <11763@well.UUCP> markg@well.UUCP (Mark Grand) writes: >The current draft of the standard does not require that the sizeof short is >less than or equal to the sizeof int; nor that sizeof int is less than or >equal to sizeof long. Sure it does. "In the list of signed integer types above, the range of values of each type is a subrange of the values of the next type in the list." This requirement can be combined with other constraints on the behavior of integers to deduce the relations between their sizeof sizes.
diamond@diamond.csl.sony.junet (Norman Diamond) (05/23/89)
In article <19.UUL1.3#5077@aussie.UUCP> rex@aussie.UUCP (Rex Jaeschke) posted: >>"... the range of values of >>each type [signed char, short, int, long] is a subrange of the values >>of the next type in the list." In article <160@mountn.dec.com> minow%thundr.dec@decwrl.dec.com (Martin Minow) writes: >Not to be picky, but the *range* of a value is not necessarily the same >thing as its storage requirement. For example, on a Vax computer, float >and double have the same range, but different size (and different precision). >Or, am I reading the standard *too* carefully? I believe "subrange" is to be interpreted like "subset", meaning that it "usually" might have fewer elements but might be exactly the same. It's perhaps a matter of reading too carelessly (sorry, but you asked). Incidentally, to pick nits, double has a very slightly larger range than float. -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.co.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-implementing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?