News for hackers. Stuff that matters.
Re:Some dark corners of C by Sharlin on Saturday March 09, 2013 @08:06AM (#5348289)
Isn't re-#defining language keywords disallowed by the C standard? It's just that most compilers don't complain about it.
Re:Some dark corners of C by mjn on Saturday March 09, 2013 @09:23AM (#5348444)
The C++ standard has a clause prohibiting macros that re-#define keywords if the translation unit also #includes a standard header. I guess this is to clarify whether the standard-library functionality is expected to still work even in the face of such a #define, by specifying that implementors don't need to worry about that situation.

I don't believe C has any such restrictions, though.

Re:Some dark corners of C by matthiasv on Saturday March 09, 2013 @08:18AM (#5348314)
The pre-processor is independent and a macro expanded before the C compiler sees it.
Re:Some dark corners of C by Sharlin on Saturday March 09, 2013 @10:02AM (#5348532)
The preprocessor is a part of the standardized translation process, and if the standard says that certain things are not allowed in a well-formed C program, it does not matter at which stage the compiler is.
Re:Some dark corners of C by matthiasv on Saturday March 09, 2013 @11:25AM (#5348779)
I'd be glad if you can pinpoint the location in the C standard where this constraint is given.
Re:Some dark corners of C by jedbrown on Saturday March 09, 2013 @12:42PM (#5349017)
C99 Section 7.1.2.4 (on standard headers): "The program shall not have any macros with names lexically identical to keywords currently defined prior to the inclusion."

You can redefine keywords in your code, but they must not be defined when including standard headers (for obvious reasons).