]> git.saurik.com Git - wxWidgets.git/commitdiff
better, more generic and backwards compatible, fix for TRUE/FALSE in C code
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Apr 2002 07:43:04 +0000 (07:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Apr 2002 07:43:04 +0000 (07:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/defs.h
src/msw/gsocket.c
src/msw/gsockmsw.c

index 7a07fa8be8a6740bec6fddf7b53aec431b3d6d5f..80b4fbb8458a8e219deb9edb90ac2357df7a9743 100644 (file)
     typedef unsigned int bool;
 #endif // bool
 
-// 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)
+#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)
+#else // !__cplusplus
+    // the definitions above don't work for C sources
+    #ifndef TRUE
+        #define TRUE 1
+    #endif
+
+    #ifndef FALSE
+        #define FALSE 0
+    #endif
+#endif // C++/!C++
 
 typedef short int WXTYPE;
 
index fc5f87c83dd05b7cfb7a571a02d3ffa4745c66f2..7fb9f308d299580586f4a9c84bbc1402ef177c31 100644 (file)
 
 #include <winsock.h>
 
-/* don't use C++ TRUE/FALSE definition which we get from wx/defs.h */
-#undef TRUE
-#undef FALSE
-#define TRUE 1
-#define FALSE 0
-
 /* if we use configure for MSW SOCKLEN_T will be already defined */
 #ifndef SOCKLEN_T
 #  define SOCKLEN_T int
index 0d9c591cb683850940341e3b85d9b8c3c9520fd1..c966cfffc1ad8d1dc416df0fb13c67b17573f1ab 100644 (file)
 
 #include <winsock.h>
 
-/* don't use C++ TRUE/FALSE definition which we get from wx/defs.h */
-#undef TRUE
-#undef FALSE
-#define TRUE 1
-#define FALSE 0
-
 #ifdef _MSC_VER
 #  pragma warning(default:4115) /* named type definition in parentheses */
 #endif