Fred Kiefer wrote:
Kazunobu Kuriyama wrote:
The general idea looks ok. But are you sure the proposed header can
live with
C99 and (reportedly coming) ObjC++? I mean, the typedef and the
following define's
seem to be problematic.
No, I am not sure. If you have any suggestions on how to make this
header file safer against upcoming compiler changes these are very
welcome.
Honestly, I know almost nothing about ObjC++. So I'm happy if someone
who knows the
stuff well corrects mistakes possibly made in the code below.
Since bool has been a predefined type in C++ and C99 (AFAIK, as of GCC
3.1 for the
latter), I think the following makes the thing safer:
#ifndef GCC_VERSION
#if __GNUC__ > 3
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 +
__GNUC_PATCH_LEVEL__)
#else
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
#endif
#if (!defined(__cplusplus)) || GCC_VERSION < 30100
typedef BOOL bool
#define false NO
#define true YES
#endif