ints
00704a-Liber
nevin1 at ihlpf.ATT.COM
Wed Feb 3 10:57:21 AEST 1988
In article <8802012142.AA16345 at decwrl.dec.com> kruger at 16bits.dec.com (I've got 50nS memory. What did you say?) writes:
>While the spirit of C is to make the size of an int convenient for the
>architecture on which it is implemented, the standard merely states
>that it is implementation dependent. However, short ints are guaranteed
>to be >= 16 bits, and short int <= int <= long int.
Which standard, K&R or ANSI?? In K&R, this is not guaranteed. Look at the
very end of section 2.2--Data Types and Sizes: "As you can see, each compiler
is free to interpret short and long as appropriate for its own hardware. About
all you can count on is that short is no longer than long."
Although it is VERY UNLIKELY that C will be implemented with shorts of less
than 16 bits, there is nothing in the standard that says it is not allowed.
About all you can guarantee (due to implicit conversions, etc.) with K&R is:
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long).
(I'll say one thing for this newsgroup: it has gotten me to reread K&R!! :-))
--
_ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194
' ) ) "The secret compartment of my ring I fill
/ / _ , __o ____ with an Underdog super-energy pill."
/ (_</_\/ <__/ / <_ These are solely MY opinions, not AT&T's, blah blah blah
More information about the Comp.lang.c
mailing list