This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Use command line defines vs defining in header files.



Can anyone give me a strong argument as whether defining constants for
conditional compiling as compiler argument vs.
   defining thems in header files?

for examples:



test.h
#ifdef COMPILER_OPT1
:
#else
:
#endif

#ifdef COMPILER_OPT2
:
#else
:
#endif
-------------------------------------------

So, if I would be defining COMPILER_OPT1 as compiler argument, I would do
something like gcc -d COMPILER_OPT1 test.cpp.

If I would defining COMPILER_OPT1 in header files, I would define it in
test.h before #ifdef COMPILER_OPT1.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]