On the one hand, Clang conservatively (and somewhat shizophrenically) claims it is GCC 4.2, by predefining __GNUC__ = 4
and __GNUC_MINOR__ = 2
.
On the other hand, glibc headers contain a number of conditional blocks that are only activated for specific GCC versions, using a macro __GNUC_PREREQ(maj, min)
that internally checks against __GNUC__
and __GNUC_MINOR__
.
For example, that macro is used (for whatever reason) to control whether wchar.h
defines the two C++-mandated overloads
wchar_t * wcschr(wchar_t * wcs, wchar_t wc); wchar_t const * wcschr(wchar_t const * wcs, wchar_t wc);
or the single C-mandated but const
-unsafe
wchar_t * wcschr(wchar_t const * wcs, wchar_t wc);
even in __cplusplus
mode.
So be warned and do not leave broken code behind, as with “Missing const.”
