diff options
Diffstat (limited to 'src/include/c.h')
-rw-r--r-- | src/include/c.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/include/c.h b/src/include/c.h index 37c0c391990..107f4f6bcd7 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -255,12 +255,21 @@ * bool * Boolean value, either true or false. * - * XXX for C++ compilers, we assume the compiler has a compatible - * built-in definition of bool. + * Use stdbool.h if available and its bool has size 1. That's useful for + * better compiler and debugger output and for compatibility with third-party + * libraries. But PostgreSQL currently cannot deal with bool of other sizes; + * there are static assertions around the code to prevent that. + * + * For C++ compilers, we assume the compiler has a compatible built-in + * definition of bool. */ #ifndef __cplusplus +#if defined(HAVE_STDBOOL_H) && SIZEOF_BOOL == 1 +#include <stdbool.h> +#else + #ifndef bool typedef char bool; #endif @@ -273,6 +282,7 @@ typedef char bool; #define false ((bool) 0) #endif +#endif #endif /* not C++ */ |