Path: utzoo!attcan!uunet!pantor!richard From: richard@pantor.UUCP (Richard Sargent) Newsgroups: comp.lang.c Subject: Re: sizeof (integral types) Message-ID: <8.UUL1.3#5109@pantor.UUCP> Date: 18 Apr 89 14:36:39 GMT References: <29127@apple.Apple.COM> Organization: Pansophic Systems Inc, Graphics Product Company Lines: 37 austing@Apple.COM (Glenn L. Austin) in > Message-ID: <29127@apple.Apple.COM> writes: > In article <10044@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: > >In article <12005@paris.ics.uci.edu> Doug Schmidt writes: > >>I realize the relation short <= int <= long holds, I'm just curious > >>whether there is any minimum that these basic types must meet (e.g., > >>short >= 16 bits, etc.). > > > >chars are at least 8 bits, > >shorts are at least 16 bits, > >longs are at least 32 bits. > > longs are guaranteed to be at least 24 bits (according to C++, sec 2.3.1) procedure flame() BEGIN Please, if you are going to quote chapter and verse, do so in context. Section 2.3.1 EXPLICITLY says "all that is guaranteed is [the usual <= relationships]." The sentence that Mr. Austin refers to begins "However, it is usually reasonable to assume ... a long has at least 24 bits." The immediate next sentence, in the same paragraph, says "Assuming more is hazardous, and even this rule of thumb does not apply universally." RTFM and quote it properly, too! END; Nothing in C or C++ is _guaranteed_ about sizes except 1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long). For all we may wish otherwise (at times), that's life, so let's just live it. Richard Sargent Systems Analyst