Solved

Order of conditional defines

Posted on 2011-03-10
2
241 Views
Last Modified: 2012-06-27
I am building a VC++ project using Borland CPP Builder. Does it matter in what order the conditional defines are defined in cpp builder project options?
0
Comment
Question by:olmuser
2 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 125 total points
ID: 35095629
(This feels like a trick question).

I would assume the way the compiler works is that all of the conditional defines are treated as if the defines existed in an include file that gets inserted as the very first line of each source code file that gets compiled.

So if you had the an options list of:
"WIN32;_WINDOWS;_DEBUG"
it would be like you had an include file with the contents:

#define WIN32
#define _WINDOWS
#define _DEBUG

and this #include would get added as the very first line of every C/C++ file in the project.

Since these commands are usually just turning ON various #ifdef lines later in the source code (or the #include files within the source code), it shouldn't mater which order these #define statements occur.
0
 
LVL 33

Expert Comment

by:sarabande
ID: 35107616
how do you build a Visual-C++ project with Borland Cpp Builder?

did you mean you took the same source code?

hookoodooku is fully right and only if you find something like XXX=YYY where YYY also is a preprocessor macro you need to care for the right order.

Sara
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now