On 2012-07-19 01:34, Jung-uk Kim wrote: > While I was tackling LibreOffice build issues, I found something > interesting about __cplusplus. Basically, different C++ compilers may > have different __cplusplus definitions and it may cause some > strangeness. Clang, for example, used to set it to 1 but now it is > set to C++ standard value since this commit: > > http://llvm.org/viewvc/llvm-project?view=rev&revision=156113
Yes, this is because gcc started doing the same. Otherwise it becomes rather difficult to distinguish C++98, C++0x and C++11 in your C++ library implementation (in the GNU case, libstdc++ most likely). ... > This causes very subtle issues depending on compiler versions and > FreeBSD versions. For example, NULL may be defined differently > because stable/9 and head have this: > > #if __cplusplus >= 201103L > #define NULL nullptr > #elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 > #define NULL __null > #else > #if defined(__LP64__) > #define NULL (0L) > #else > #define NULL 0 > #endif /* __LP64__ */ > #endif /* __GNUG__ */ > > Before that, we had this: > > #if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 > #define NULL __null > #else > #if defined(__LP64__) > #define NULL (0L) > #else > #define NULL 0 > #endif /* __LP64__ */ > #endif /* __GNUG__ */ > > What a mess... Well, this is what you get when standards progress to include non-standard features (such as gcc's "__null") that are already in use, but then subtly change them (calling them "nullptr"). However, as long as you can hide the #ifdef ugliness in a header, I don't really see the problem. This won't be the last ugly definition either. :) _______________________________________________ freebsd-ports@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"