Mail Archives: djgpp/1996/05/03/03:49:16
Reply to message 1204146 from MAX AT ALCYONE DOT C on 04/29/96 10:55AM
>There is nothing to correct, because nothing is wrong. ANSI C does not put
>limitations on the sizes of types other than that sizeof char <= sizeof short
><= sizeof int <= sizeof long. (Actually, there _are_ actually some further
>limitations, but they don't go to the level of specifying the byte-width of
>these types.)
Close, but not quite. ANSI C does in fact specify the following conditions
for type sizes:
sizeof short >= 2 bytes (-32767 to +32767)
sizeof long >= 4 bytes (-2147483647 to +2147483647)
sizeof short <= sizeof int <= sizeof long
sizeof char == large enough to store the basic character set for the system
unsigned <type> == same size as signed <type>
sizeof float >= 4 bytes (or 6 significant digits)
sizeof double >= sizeof float (but must store 10 significant digits)
sizeof long double >= sizeof double
So the only thing that is any different between a 16- and 32-bit compiler is
the
sizeof int, which can be either 2 or 4 bytes. Actually, pointers can also be
either 2 or 4 bytes, but they are usually the same as the int size. Floating
point sizes vary arbitrarily by compiler.
Lest ye doubt my words, I am quoting directly from The Waite Group's _New
C Primer Plus_, 2nd edition. :)
John
- Raw text -