Skip to content

Commit

Permalink
c++ macro test
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Dec 22, 2015
1 parent 6a0004c commit ddef30f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cpp-macro.cpp
@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;

int a() { return 2; }
int b() { return 3; }


int main() {
cout << a() << " " << b() << endl;

#define a b
#define b a
cout << a() << " " << b() << endl;

#undef a
#undef b
#define b a
#define a b
cout << a() << " " << b() << endl;

#undef a
#undef b
#define b a
cout << a() << " " << b() << endl;

return 0;
}

0 comments on commit ddef30f

Please sign in to comment.