This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
C/C++ Preprocessor -- #ifdef to if(){....}
- From: Elden Crom <EldenC at TucsonEmbedded dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 31 Mar 2010 21:24:13 +0000
- Subject: C/C++ Preprocessor -- #ifdef to if(){....}
Is there a slick-but-evil (preprocessor?) mechanism to replace
-----------------------
#ifdef DEBUG_XXX
printf("Some debug data\n");
#endif
-----------------------
With
=============================
extern "C" int global_debug_print;
if(global_debug_print>0){
printf("Some debug data\n");
}
=============================
While not touching other '#if ... [#else] ... #endif' constructs
Elden Crom
Tucson Embedded Systems, Inc
520-575-7283 x141
Fax: 520-575-5563
Cell: 520-429-2771
Email:EldenC@TucsonEmbedded.com
5620 N. Kolb Road
Suite 160
Tucson, AZ 85750-1384