Solved

Order of conditional defines

Posted on 2011-03-10
2
242 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.

831 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