Path: utzoo!attcan!uunet!pantor!richard From: richard@pantor.UUCP (Richard Sargent) Newsgroups: comp.lang.c Subject: Re: sizeof (integral types) Message-ID: <7.UUL1.3#5109@pantor.UUCP> Date: 17 Apr 89 15:00:48 GMT References: <10044@smoke.BRL.MIL> Organization: Pansophic Systems Inc, Graphics Product Company Lines: 33 gwyn@smoke.BRL.MIL (Doug Gwyn) in Message-ID: <10044@smoke.BRL.MIL> 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. I quote from the ANSI C DRAFT dated January 11, 1988, Section 3.1.2.5: An object declared as type char is large enough to store any member of the basic execution character set. ... There are four _signed integer types_, designated as signed char, short int, int, and long int. ... ... A "plain" int object has the natural size SUGGESTED by the architecture of the execution environment ( ... in the header ). In the list of signed integer types above, the range of values of each type is a subrange of the values of the next type in the list. Please note that this definition explicitly avoids any claims about the sizes of the types except for the "<=" business in the first message. It most definitely does NOT say anything about 8, 16, or 32 bits! In fact, the definition permits implementations of 8 bit longs and others of 32 bit chars! (Of course, no one in their right mind would try to sell such a product, but it is not forbidden by the language definition.) Richard Sargent Systems Analyst