Path: utzoo!utgpu!attcan!uunet!husc6!spdcc!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.c Subject: Re: Absolute size of 'short' Message-ID: <195@lakart.UUCP> Date: 8 Aug 88 00:24:52 GMT References: <62505@sun.uucp> Organization: Lake - The systems people Lines: 22 From article <62505@sun.uucp>, by guy@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@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!cca!lakart!dg +-+-+ | +---+