Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Order of conditional defines

Posted on 2011-03-10
2
Medium Priority
?
271 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:Mydeen Yussouf
2 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 500 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 35

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

927 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