From ad95fe268a9ef45a55521636f7504d21ef998638 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 1 May 2002 16:20:49 +0000 Subject: [PATCH] added WX_TRUE_DEFINED to allow preventing the redefinition of TRUE/FALSE git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index a3ea865ebd..897d1addb3 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -176,11 +176,20 @@ #ifdef __cplusplus // define boolean constants: don't use true/false here as not all compilers - // support them - #undef TRUE - #undef FALSE - #define TRUE ((bool)1) - #define FALSE ((bool)0) + // support them but also redefine TRUE which could have been defined as 1 + // by previous headers: this would be incorrect as our TRUE is supposed to + // be of type bool, just like true, not int + // + // however if the user code absolutely needs TRUE to be defined in its own + // way, it can predefine WX_TRUE_DEFINED to prevent the redefinition here + #ifdef TRUE + #ifndef WX_TRUE_DEFINED + #undef TRUE + #undef FALSE + #define TRUE ((bool)1) + #define FALSE ((bool)0) + #endif + #endif #else // !__cplusplus // the definitions above don't work for C sources #ifndef TRUE