]> git.saurik.com Git - wxWidgets.git/commitdiff
added WX_TRUE_DEFINED to allow preventing the redefinition of TRUE/FALSE
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 1 May 2002 16:20:49 +0000 (16:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 1 May 2002 16:20:49 +0000 (16:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/defs.h

index a3ea865ebd1303bc6f23c338a825df7e5aae09bf..897d1addb35c915dfcbebabb903824133090e8ae 100644 (file)
 
 #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