Sujet : Re: do { quit; } else { }
De : rjh (at) *nospam* cpax.org.uk (Richard Heathfield)
Groupes : comp.lang.cDate : 15. Apr 2025, 09:18:15
Autres entêtes
Organisation : Fix this later
Message-ID : <vtl4o7$39391$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
User-Agent : Mozilla Thunderbird
On 15/04/2025 08:40, Janis Papanagnou wrote:
On 14.04.2025 15:00, James Kuyper wrote:
On 4/14/25 00:43, Janis Papanagnou wrote:
...
Honestly, this is an old, known argument that I could never fully
understand. 'char' for characters, 'int' as a register sized entity,
'short' and 'long' as, say, additions. So far so good. "For a wide
variety of platforms" you cannot just use 'int' and hope that works
on 8, 16, or 32 bit processors the same way. Switching to 'long' or
'short' also doesn't provide any portability property since you've
no guarantee whether the necessary ranges can be represented with
them.
>
Huh? There's guarantees for every one of those types.
Has that changed?
No. The guarantees go at least as far back as 1989.
- I recall that there were only "compare to"
relations defined, like |short| <= |int| <= |long|
From back in the day:
[quote from ANSI C89]
2.2.4.2 Numerical limits
A conforming implementation shall document all the limits specified in this section, which shall be specified in the headers <limits.h> and <float.h> .
"Sizes of integral types <limits.h>"
The values given below shall be replaced by constant expressions suitable for use in #if preprocessing directives. Their implementation-defined values shall be equal or greater in magnitude (absolute value) to those shown, with the same sign.
[end quote]
The Standard then dictates the minimum ranges that each numerical type must support.
<snip>
-- Richard HeathfieldEmail: rjh at cpax dot org dot uk"Usenet is a strange place" - dmr 29 July 1999Sig line 4 vacant - apply within