BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TC2006 - Enum always integer sized

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Non-Technical)
View previous topic :: View next topic  
Author Message
Sebastian Ledesma [Solidy
Guest





PostPosted: Wed Apr 25, 2007 8:13 pm    Post subject: TC2006 - Enum always integer sized Reply with quote



Hi:

I've just noticed that the default project in TC2006 doesn't select the
option 'Enum always integer sized (-b)*'
(Project->Options->C++ compiler (bcc32)->Compiling).
Neither in Debug or Release configuration uses this option.
The command line compiler declares this option as default (-b). In BC5.0
this was also the behavior (Allocate enum as ints).
This can present some imcompatibilities when migrating projects.

Can someone confirm this?

Thanks in advance.

Saludos
Sebastian

PS: To create a default project I just used: File->New: Console project and
File->New: VCL Form application
Back to top
Tamas Demjen
Guest





PostPosted: Wed Apr 25, 2007 10:13 pm    Post subject: Re: TC2006 - Enum always integer sized Reply with quote



Sebastian Ledesma [Solidyne Labs] wrote:

Quote:
I've just noticed that the default project in TC2006 doesn't select the
option 'Enum always integer sized (-b)*'
(Project->Options->C++ compiler (bcc32)->Compiling).
Neither in Debug or Release configuration uses this option.
The command line compiler declares this option as default (-b). In BC5.0
this was also the behavior (Allocate enum as ints).
This can present some imcompatibilities when migrating projects.

This is the source of major incompatibilities. VCL requires that enums
are treated as bytes. The rest of the world treats enums as integers.
This makes it hard to use 3rd party DLLs with VCL projects. I usually
check (turn on) the "Treat enum types as ints" option in BCB6 for those
units that deal with VC++ DLLs. Also for BCB DLLs intended to be used
from VC++.

It's very easy to crash your application by passing a pointer or
reference to an enum between Borland and Microsoft, due to the different
interpretation of enums. Such bugs are extremely hard to find, so keep
an eye open when using enums between different compilers. Most 3rd party
software has this issue -- all the OCR engines, barcode readers, search
engines, virtually every DLL that was not designed specifically for Delphi.

I can't confirm this in TC2006. I'm still using BCB6 for production.

Tom
Back to top
Sebastian Ledesma [Solidy
Guest





PostPosted: Thu Apr 26, 2007 12:29 am    Post subject: Re: TC2006 - Enum always integer sized Reply with quote



Ok. I find the way to solve.

Start TC, go to Project->Options->C++ compiler (bcc32)->Compiling and click
Enum always integer sized (if not clicked).
Now every project you create will have the option checked.
Also if you open an existing project and enable the checkbox located
bottom-left called _default_ when closing the options dialog (with [OK]
button)
the future projects created with use the current configuration as _default_.
So, probably it's not a bug, it's just a configuration case. I guess I
unchecked that option by error in some time. To real verify this I should
install TC in a clean system and don't have time to do it now.

Best regards,
Sebastian

PS: keep doing good work CG.

"Sebastian Ledesma [Solidyne Labs]" <labo[no_sp@m]solidyne1.com> escribió en
el mensaje news:462f6ff7$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi:

I've just noticed that the default project in TC2006 doesn't select the
option 'Enum always integer sized (-b)*'
(Project->Options->C++ compiler (bcc32)->Compiling).
Neither in Debug or Release configuration uses this option.
The command line compiler declares this option as default (-b). In BC5.0
this was also the behavior (Allocate enum as ints).
This can present some imcompatibilities when migrating projects.

Can someone confirm this?

Thanks in advance.

Saludos
Sebastian

PS: To create a default project I just used: File->New: Console project
and File->New: VCL Form application
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Non-Technical) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.