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 

Builder Version Constant?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
newsgroups.borland.com
Guest





PostPosted: Thu May 17, 2007 10:43 pm    Post subject: Builder Version Constant? Reply with quote



How can a program know at compile time if it's being built under BCB5 or
BCB6? I maintain a C++ library which is used by other programmers at my
company. Most of our programs are written with BCB5, but BCB6 is trickling
in. I've just received a bug report that a library function's name clashes
with a name used by BCB6. Simply changing the name would break existing
BCB5 applications. Is there a Borland-defined constant (like WINVER) that
identifies the version of Builder? I'd like to do this:



#if (BUILDER_VERSION = 5)

int OldConflictingName(int* data)

#else

int NewNameForSameFunction(int* data)

#endif



Thanks in advance,



Robert L. Smith
Back to top
Andrew Bond
Guest





PostPosted: Thu May 17, 2007 11:39 pm    Post subject: Re: Builder Version Constant? Reply with quote



Robert

Quote:
How can a program know at compile time if it's being built under BCB5 or
BCB6?Robert L. Smith

#if (__BORLANDC__ >= 0x0700)
// Borland C++BuilderX 1 (bccx.exe)
#elif (__BORLANDC__ >= 0x0590)
// CodeGear C++Builder 2007 (bcc.exe)
#elif (__BORLANDC__ >= 0x0580)
// Borland C++Builder 2006 (bcc.exe)
#elif (__BORLANDC__ >= 0x0560)
// Borland C++Builder 6 (bcc.exe)
#elif (__BORLANDC__ >= 0x0550)
// Borland C++Builder 5 (bcc.exe)
#else
#error Borland compiler earlier than C++Builder 5
#endif

HTH

Andrew
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu May 17, 2007 11:55 pm    Post subject: Re: Builder Version Constant? Reply with quote



"newsgroups.borland.com" <x.x> wrote in message
news:464c9436 (AT) newsgroups (DOT) borland.com...

Quote:
Is there a Borland-defined constant (like WINVER) that
identifies the version of Builder?

Yes - the __BORLANDC__ precompiler define.

Quote:
I'd like to do this:

#if ((__BORLANDC__ >= 0x0550) && (__BORLANDC__ < 0x0560))
// is BCB 5 ...
#else
// not BCB 5 ...
#endif

The reason for the range checking is because service packs increment
the last hex digit, ie 0x551, 0x0552, etc.

This would be a better aproach:

#if (__BORLANDC__ < 0x0560)
// is before BCB 6 ...
#else
// is BCB 6 or higher ...
#endif


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) 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.