Date: Sun, 9 Oct 1994 14:03:17 +0500 From: cigna AT helios DOT phy DOT ohiou DOT edu (Mr. Salty) To: fwreimer AT crl DOT com Subject: Re: djgpp and the 386SX Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Fred Reimer said: !On Sat, 8 Oct 1994, Chris Tate wrote: !> Borland and Microsoft certainly *do* use 32-bit integers; they're just !> declared "long" instead of "int." Why is this a problem? !Let's be a little more detailed here. First, my !reference point is Borland C++ 3.1 and Microsoft Visual C 1.0 (yes, I !actually paid for both of these compilers). One of the reasons I !purchased both compilers is because they both were said to be "32-bit !compilers" in the upgrade offers. But this is simply not true! Yes, they !do both have a 32-bit TYPE (longs), and they both have /3 switches to the !compiler that is supposed to produce "32-bit code" or use "32-bit !instructions" (only runnable on 386+ CPU's. But you'd be hard pressed to !find an instruction that uses any of the extended registers in any !compiled code (EAX, EBX, etc.). Instead, the "extended" instructions they !use are ENTER and LEAVE and such, not as much a benefit as using the !extended registers. They both included a DOS extender (I believe Phar I compiled to assembly the following program: main() { long a = 10, b = 20, c = 0; c = a + b; } When compiled with borland using "bcc -S -3 tst.c" the output was: mov dword ptr [bp-4],large 10 mov dword ptr [bp-8],large 20 mov dword ptr [bp-12],large 0 mov eax,dword ptr [bp-4] add eax,dword ptr [bp-8] mov dword ptr [bp-12],eax When compiled using djgpp with "gcc -S tst.c" the output was: movl $10,-4(%ebp) movl $20,-8(%ebp) movl $0,-12(%ebp) movl -4(%ebp),%edx addl -8(%ebp),%edx movl %edx,-12(%ebp) The assembler syntax is different, but it looks like they both use 32 bit registers for 32 bit integers. Notice however that Borland C 3.1 uses bp (16 bits) to hold a *pointer*, while djgpp uses ebp (32 bits). In the Intel world "32 bit code" == "flat memory model" and "16 bit code" == "segment:offset addressing". It has tremendously little to do with the size of an integer. - Dave Cigna