3 ms·
According to C99, section 7.1.3: If the program declares or defines an identifier in a context in which it is reserved (other than as allowed by 7.1.4)
by nybble41 7y ago
According to C99, section 7.1.3:
If the program declares or defines an identifier in a context in
which it is reserved (other than as allowed by 7.1.4), or defines
a reserved identifier as a macro name, the behavior is undefined.
It doesn't matter what the macro would expand to; simply defining the reserved identifier as a macro triggers undefined behavior. That doesn't mean it won't work, for some specific combination of standard headers, compiler, and program source code. It just isn't a strictly conforming program. A conforming implementation is allowed to flag this as an error, ignore the definition, or simply generate nonsense output.