From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: Why does sizeof give me... Date: Tue, 12 Aug 1997 23:25:59 -0700 Organization: Alcyone Systems Lines: 22 Message-ID: <33F15377.7DAF3CDD@alcyone.com> References: <33E957BE DOT 7216 AT geocities DOT com> <5sbrun$k8i AT freenet-news DOT carleton DOT ca> NNTP-Posting-Host: newton.alcyone.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 Paul Derbyshire wrote: > Two things: firstly, gcc is 32 bit and treats int as long, not short. > Make > your app use short and long explicitly. Use short where the 16 bit app > used int in the structs. Second, gcc pads structs. Read the info on > __attribute__ ((packed)) and use it on the struct. 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.) -- Erik Max Francis, &tSftDotIotE / email / mailto:max AT alcyone DOT com Alcyone Systems / web / http://www.alcyone.com/max/ San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W \ "Love is not love which alters / when it alteration finds." / William Shakespeare, _Sonnets_, 116