This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Use command line defines vs defining in header files.
- To: gcc at gcc dot gnu dot org
- Subject: Use command line defines vs defining in header files.
- From: rlau at csc dot com
- Date: Mon, 28 Aug 2000 15:11:32 -0500
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.