I think it's a bad idea to undefine these macros. We should just use different names. We don't know what other code might break because we re-define a previously established macro...
The point is these
are not established macros. They are just computer-generated bullshit.
The gcc documentation even states that these macros violate the ISO standard. More precisely, it says that if the non-standard macros
unix and
linux (or similar ones) are present in some outdated implementation, then Gcc will
also define the correct, standard-compliant ones (
__unix__ and
__linux__).
According to ISO, you are guaranteed that any platform/compiler specific macros start with at least one underscore. At the same time, you must not use identifiers that start with underscores in your code (as these names are reserved for the compiler/platform).
Thus, there is really no legal way that
namespace platform { const int linux; }; could be secretly replaced by some obnoxious macro.
However, reality looks like gcc just defines these macros
anyway, which is really really bad.
So by undefining them, we're actually making things better
This issue, by the way, is a glancing example of why macros suck so bad, and why we should really get rid of any macros and preprocessor directives that we don't strictly need. Macros are just plain evil and stupid like a loaf of bread, you can't say otherwise...
There are still a few places where we can't work around preprocessor alltogether, but I'd suggest we really , really do where we can.