kruger@16bits.dec.com (I've got 50nS memory. What did you say?) (02/02/88)
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. dov
nevin1@ihlpf.ATT.COM (00704a-Liber) (02/03/88)
In article <8802012142.AA16345@decwrl.dec.com> kruger@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