From 691aba016bccb44aa30cb7fdd9c232a85d56c4b2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 16 Apr 2002 07:43:04 +0000 Subject: [PATCH] better, more generic and backwards compatible, fix for TRUE/FALSE in C code git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 23 +++++++++++++++++------ src/msw/gsocket.c | 6 ------ src/msw/gsockmsw.c | 6 ------ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 7a07fa8be8..80b4fbb845 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -174,12 +174,23 @@ 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; diff --git a/src/msw/gsocket.c b/src/msw/gsocket.c index fc5f87c83d..7fb9f308d2 100644 --- a/src/msw/gsocket.c +++ b/src/msw/gsocket.c @@ -60,12 +60,6 @@ #include -/* 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 diff --git a/src/msw/gsockmsw.c b/src/msw/gsockmsw.c index 0d9c591cb6..c966cfffc1 100644 --- a/src/msw/gsockmsw.c +++ b/src/msw/gsockmsw.c @@ -55,12 +55,6 @@ #include -/* 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 -- 2.49.0