Solved

Order of conditional defines

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

747 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