Date: Mon, 29 Apr 1996 00:28:31 +0800 (GMT+0800) From: Orlando Andico To: Nicholas Lynch cc: djgpp AT delorie DOT com Subject: Re: sizeof(int) == 4?! In-Reply-To: <4m03nd$nsc@freenet-news.carleton.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII That's because that's how it's down in Unix. It is not true that an "int" is always 16-bits long. ANSI C specifies that a long is AT LEAST the size of an int, not necessarily longer. To use a 2-byte int, use "short int" On 28 Apr 1996, Nicholas Lynch wrote: > I was having some trouble using a structure to load a file header in DJGPP. > I found that it worked in borland C no problem. So, I wrote a little test > program that would give me the sizes of several data types: > > Borland C/C++: > > Variable Size > --------------------- > int 2 > unsigned int 2 > long 4 > ... > > But in DJGPP: > > Variable Size > --------------------- > int 4 > unsigned int 4 > long 4 > ... > > Is there any way of correcting this? (I belive that this problem cropped up > earlier in thee newsgroup, but I didn't save the solution :( Or, should I > just use a different data type instead of int? > > Thanks in advance... > -- > O Nicholas Lynch > -|- br516 AT freenet DOT carleton DOT ca > / \ >