Possible 32-bit problem with Borland C++ v3.1 
Author Message
 Possible 32-bit problem with Borland C++ v3.1

Hope this is the correct group to post this to. If not, please let me
know!

Does anyone know if there is a problem with generating 32-bit C code
within Borland C++ v3.1 (DOS target). I have told the compiler to
generate 80386 code from the IDE, but there are instances where I am
doing a comparison between two 32-bit numbers which fails, but shouldn't
according to the actual values used. My preliminary thoughts are that
possibly the high word is being lost during an interrupt handler (the
handlers are also written in C) that possibly doesn't push the extended
registers, just the normal 16-bit ones. If anyone else has had
experience of this kind of problem, or would like further information,
please let me know, either by this group, or by email:


Thanks,

Paul Gomme



Tue, 16 Nov 1999 03:00:00 GMT  
 Possible 32-bit problem with Borland C++ v3.1

Quote:

> Hope this is the correct group to post this to. If not, please let me
> know!

> Does anyone know if there is a problem with generating 32-bit C code
> within Borland C++ v3.1 (DOS target). I have told the compiler to
> generate 80386 code from the IDE, but there are instances where I am
> doing a comparison between two 32-bit numbers which fails, but shouldn't
> according to the actual values used. My preliminary thoughts are that
> possibly the high word is being lost during an interrupt handler (the
> handlers are also written in C) that possibly doesn't push the extended
> registers, just the normal 16-bit ones. If anyone else has had
> experience of this kind of problem, or would like further information,
> please let me know, either by this group, or by email:

        Generating 386 code is not the same as generating 32-bit code.
Oversimplified, the 386 can run in either of two modes: 16-bit and
32-bit. If you're running on a 16-bit operating system like DOS or Win
3.1, you need to generate 16-bit code. Actually, you can run 32-bit code
on a 16-bit operating system with a DOS extender, which complicates
things a bit.
        When you tell the compiler to generate 386 code you are telling it that
your program will never run on a 286 or 8086, so it can take advantage
of the new features that the 386 added to the instruction set. These new
features include things like more sophisticated string comparisons done
directly in hardware, etc. They can make your program run faster. They
are available when the 386 is running as a 16-bit processor and when it
is running as a 32-bit processor. Selecting this option simply allows
the compiler more freedom in choosing which instructions to use in
translating your program. It does not change the fact that BC++ 3.1
generates 16-bit code. In order to get 32-bit code you need to move to
4.0 or higher.
        -- Pete


Tue, 16 Nov 1999 03:00:00 GMT  
 Possible 32-bit problem with Borland C++ v3.1

Quote:

> Hope this is the correct group to post this to. If not, please let me
> know!

Hi "Paul Gomme",

It's not exactly correct here, because we mainly discuss the standard C
language here, in a system independant and portable way.

Quote:
> Does anyone know if there is a problem with generating 32-bit C code
> within Borland C++ v3.1 (DOS target). I have told the compiler to
> generate 80386 code from the IDE, but there are instances where I am
> doing a comparison between two 32-bit numbers which fails, but shouldn't
> according to the actual values used.

This is both: prozessor and compiler specific. Standard C code shouldn't
have to rely on any of this. Write portable C code and leave most of the
optimizations to the compiler. Especially the system dependant ones.

Quote:
> My preliminary thoughts are that
> possibly the high word is being lost during an interrupt handler (the
> handlers are also written in C) that possibly doesn't push the extended
> registers, just the normal 16-bit ones.

The description of your problems makes it hard for me, to decide, which
other newsgroups to recommend, so I'll leave the choice to you:



The last one is probably the best place to start.

Stephan
(self appointed member of the campaign against grumpiness in c.l.c)



Tue, 16 Nov 1999 03:00:00 GMT  
 Possible 32-bit problem with Borland C++ v3.1

Quote:


>> Hope this is the correct group to post this to. If not, please let me
>> know!

>> Does anyone know if there is a problem with generating 32-bit C code
>> within Borland C++ v3.1 (DOS target). I have told the compiler to
>> generate 80386 code from the IDE, but there are instances where I am
>> doing a comparison between two 32-bit numbers which fails, but shouldn't
>> according to the actual values used. My preliminary thoughts are that
>> possibly the high word is being lost during an interrupt handler (the
>> handlers are also written in C) that possibly doesn't push the extended
>> registers, just the normal 16-bit ones. If anyone else has had
>> experience of this kind of problem, or would like further information,
>> please let me know, either by this group, or by email:

That may well be the case but it is an issue relating to DOS and your
particular compiler, the C language itself knows nothing about 16 bit and
32 bit registers. You'd be better off posing to a newsgroup such as
comp.os.msdos.programmer.

...

Quote:
>        When you tell the compiler to generate 386 code you are telling it that
>your program will never run on a 286 or 8086, so it can take advantage
>of the new features that the 386 added to the instruction set. These new
>features include things like more sophisticated string comparisons done
>directly in hardware, etc.

And 32 bit registers which *are* accessible in 16 bit processor modes if
you have a 386 or better.

--
-----------------------------------------


-----------------------------------------



Thu, 18 Nov 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Borland C++ 5.0, 32-bit-DLL, description/versioninfo

2. pointer madness in 32 bit borland c++

3. 32-bit VC 2.2 DLLs with 32-bit VB4

4. top 32 bits of 64-bit product of two 32-bit integers

5. 16 Bit interrupts and 32 Bit Visual C++

6. Linking 32 bit VC++4.2 DLLs with VB4.0 32 bit

7. problem in 16 bit program calling 32 bit DLL

8. Problem Porting a 16 bit DLL to 32 bit

9. compiler memory problems with Borland C++ v3.1

10. Help: Beginner problem with Novell SDK and Borland C++ v3.1

11. Borland C/C++ v3 problem

12. Borland C++ v3.1 Lan install problem

 

 
Powered by phpBB® Forum Software