www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/05/21:31:01

Date: Wed, 5 Oct 1994 10:32:44 -0700 (PDT)
From: "Frederick W. Reimer" <fwreimer AT crl DOT com>
Subject: Re: djgpp and the 386SX
To: "Don L." <lopez AT vsl DOT ist DOT ucf DOT edu>
Cc: Brian Acton <brian_acton AT powertalk DOT apple DOT com>,
"djgpp AT sun DOT soe DOT clarkson DOT edu" <djgpp AT sun DOT soe DOT clarkson DOT edu>

On Tue, 4 Oct 1994, Don L. wrote:

> On 28 Sep 1994, Brian Acton wrote:
> 
> > Hello All,
> > 
> > I'm compiling with the flags "-mno-486"
> > 
> > The lines of code that appear to generate the floating point exception are:
> > 
> > int i;
> Off hand I don't know what the "-mno-486" flag does but by ANSI C 
> definitions, an signed integer as you have declared "i" to be; has the 
> maximum and minimum values of -32,767 to 32,767. You want to declare "i" 
WRONG! These are the minimally accepted values for signed integers.  
DJGPP, and any other TRUE 32 bit compiler, uses 32 bit integers.

Summary:	type	32-bit compiler		16-bit compiler
		char	8 bits			8 bits
		short	16 bits			16-bits
		int	32 bits			16-bits
		long	32 bits			32-bits

As you can see, the only real difference is the size of a 'int'.  If you 
want to assume a 16-bit range, use short instead (I havn't come accross a 
compiler in which short was NOT 16 bits, but there's always a possibility).

Generally, shorts are 16 bits, longs 32 bits, and ints whatever fits into 
a standard register for the system.  Regular DOS compilers only use the 
low 16 bits of the 386+'s 32 bit registers, DJGPP uses the full 32bits, 
hence the difference.

> as a unsigned int ( now i can be from 0 to 65000 ) or a unsinged long or 
> long int which gives you 4 million for the unsigned long or +/- 2million 
> for the signed long int. 
> 

Fred Reimer

+-------------------------------------------------------------+
| The views expressed in the above are solely my own, and are |
| not necessarily the views of my employer.  Have a nice day! |
| PGP2.6 public key available via `finger fwreimer AT crl DOT com`   |
+-------------------------------------------------------------+



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019