From: Jeff Weeks Newsgroups: comp.os.msdos.djgpp Subject: Re: Why does sizeof give me... Date: Wed, 13 Aug 1997 00:17:28 -0400 Organization: Code X Software Lines: 42 Message-ID: <33F13558.75F9BE9E@execulink.com> References: <97Aug13.151644gmt+0100 DOT 17061 AT internet01 DOT amc DOT de> NNTP-Posting-Host: ppp10.orion.execulink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Chris Croughton wrote: > > Erik Max Francis wrote: > > >As the chief ANSI C advocate on this newsgroup, I should point out that > >ANSI does not say anything about the size of the fundamental integer types > >(short, int, long), except that short is no larger than int and int is no > >larger than long, and short is at least 16 bits and long is at least 32. > >(What's interesting is that these latter two requirements are hidden > >rather well in the standard.) > > I have used one compiler (VAX, possibly?) which had short = int = long > and > all 32 bit. Fortunately, char was still 8 bit (but it needn't be - some > machines have 9 bit chars). 9 bit chars!? Weird. So they used a 16-bit word and ignored 7 bits? > The only portable way is to do it yourself - either by breaking longer > variables up into chars or in ASCII. Especially since you can't rely > on any byte ordering scheme (I gather there are some machines where a > long is held in memory as bytes 2, 1, 4 and 3 or something similar, not > even a reversible format). Well, I know Intel's load, say, 1234h into memory as 3412... atleast I think that's it. And 12345678h would be 78563412... not totally sure though. > Isn't this all in the FAQ? Or was it one of the other C newsgroup FAQs? Don't think it would be in the DJGPP faq. Unless you're refering to int's being 32-bit... yeah, I think that's in the faq. Jeff -------------------------------------------- - Code X Software - Programming to a Higher Power email: mailto:pweeks AT execulink DOT com web: http://www.execulink.com/~pweeks/ --------------------------------------------