Absolute size of 'short'

David Goodenough dg at lakart.UUCP
Mon Aug 8 10:24:52 AEST 1988


>From article <62505 at sun.uucp>, by guy at gorodish.Sun.COM (Guy Harris):
> someone else says:
>> No.  I have seen at least one compiler where sizeof(short) is one
>> byte.
> 
> In which case the vendor of the compiler either 1) won't make it ANSI
> C-conformant or 2) will make "sizeof (short)" two bytes (assuming 8-bit bytes
> here; if bytes are 16 bits they're safe).

The following explanation springs to mind. There are old compilers still in
use (saints help me - I use Leor Zolman's BDS C on my CP/M machine at home :-)
that's vintage 1979!!). Now, back when the Gospel according to Kernighan and
Ritchie came out, it said:
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
i.e. the above compiler conformed to K&R. However there are K&R
conformant things that don't cut it with ANSI. Nobody's fault, just a fact
of life.
-- 
	dg at lakart.UUCP - David Goodenough		+---+
							| +-+-+
	....... !harvard!cca!lakart!dg			+-+-+ |
						  	  +---+



More information about the Comp.lang.c mailing list