Article View: comp.std.c
Article #4265Re: Byte and Char, was Re: Is this a good Idea??
From: Paul Long
Date: Mon, 23 Oct 1995 04:57
Date: Mon, 23 Oct 1995 04:57
31 lines
1733 bytes
1733 bytes
In article 46ebs0$7l2@lyra.csx.cam.ac.uk, sgt20@cam.ac.uk (Simon Tatham) writes: >David Mccaughan <davidb@sawnlk.cs.ualberta.ca> wrote: >>Lawrence Crowl (crowl@jade.CS.ORST.EDU) wrote: [snip] >>I think you'll find that he was making reference to the fact that the C >>standard does not specify the "size" of data types (this being largely a >>machine dependent issue) - as such it is up to the compiler writer to >>specify this. > >Not quite - Kernighan & Ritchie, second edition, specifies that "int" >and "short" should be at least 16 bits, and "long" should be at least >32. It *is* up to the compiler writer, of course, but those are >minimum limits. Not quite. :-) The Standard only specifies the minimum size of a byte (8 bits). All other minimum sizes of arithmetic types are _implied_ by 1. the range of values that they are required to represent and 2. the fact that they must be multiples of a byte. For example, the Standard does not state that an int must be at least 16 bits long, but it does state that an int must be able to represent the values from -32767 to +32767. Surprise! A 16-bit int will do just fine in implementations where a byte is either 8 or 16 bits long. I think this is the point that the person to whom you were replying was making--the Standard does not, strictly speaking, specify the size of data types. Paul_Long@ortel.org plong@perf.com
Technical Details
Message-ID:
<3259822046.1683355@ortel.org>Path:
arc1-ca.pugleaf.net!uu4news.netcom.com!otsrvr!Paul_LongShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!uu4news.netcom.com!otsrvr!Paul_Long From: Paul_Long@ortel.org (Paul Long) Reply-To: Paul_Long@ortel.org Newsgroups: comp.std.c Distribution: world Subject: Re: Byte and Char, was Re: Is this a good Idea?? Date: 23 Oct 1995 04:57:31 GMT Message-ID: <3259822046.1683355@ortel.org> Organization: Oregon Telcom