Preprocessor macros are very handy, but very easy to abuse. One day in college, a few of us sat around trying to think of devious macros we could include in our projects that would mess up other contributors' code.
We tried
#define 1 (-12)
, but it wouldn't compile.We did succeed in
#define main foo
to eliminate the main function, but my personal favorite takes two lines:
#define if while
#define else
And of course, to be a good hygienic programmer, you'd want to include the accompanying #undefs. Please never use this.
I can just imagine some confused code successor looking at the file and asking, "Why does this file end with #undef if? Uhh....."
No comments:
Post a Comment