In a global header long time ago, a friend of mine (and big "C" lover) did this to his best buddy once (a C++ and especially boost lover):
#define class struct
#define private public
#define protected public
#define class struct
#define private public
#define protected public
#define true false
#define false true
#define true 0
#define false !true
#define if while
#define continue break
:) #define true false
#define false true
Did you know that if you do both of those, they cancel each other out? True story.First make a file a.c that has in it:
#define true false
#define false true
int A = true;
int B = false;
then from the command line, do (with the Microsoft compiler): D:\>cl -E a.c
int A = true;
int B = false;
Now with gcc (I'm using cygwin's gcc): D:\>sh -c "gcc -E a.c"
int A = true;
int B = false;
I've stripped the other stuff.
The consequence of this rule is that cycles of #defines don't do anything. Edit: Well, that's only true if there aren't other symbols introduced during expansion. Here's a counterexample that prints 3:
#include <stdio.h>
int x = 1;
#define x 1 + y
#define y 1 + x
int main(int argc, char *argv[])
{
printf("%d\n",x);
return 0;
} #define TRUE random()%2(While being quite funny, mind you!)
The image halted immediately.