1 struct X { int i; int j; }; 2 #define FOO struct X 3 #define FOO10(x) FOO x ## 0; FOO x ## 1; FOO x ## 2; FOO x ## 3; FOO x ## 4; FOO x ## 5; FOO x ## 6; FOO x ## 7; FOO x ## 8; FOO x ## 9; 4 #define FOO100(x) FOO10(x ## 0) FOO10(x ## 1) FOO10(x ## 2) FOO10(x ## 3) FOO10(x ## 4) FOO10(x ## 5) FOO10(x ## 6) FOO10(x ## 7) FOO10(x ## 8) FOO10(x ## 9) 5 FOO100(x0) FOO100(x1)6 FOO100(x1) 7 FOO100(x2) 8 FOO100(x3) 9 FOO100(x4) 10 FOO100(x5) 11 FOO100(x6) 12 FOO100(x7) 13 FOO100(x8) 14 FOO100(x9) 15 16 #define COO(n,f) case n: p = &f; break; 17 #define COO10(n,f) COO(n ## 0, f ## 0) COO(n ## 1, f ## 1) COO(n ## 2, f ## 2) COO(n ## 3, f ## 3) COO(n ## 4, f ## 4) COO(n ## 5, f ## 5) COO(n ## 6, f ## 6) COO(n ## 7, f ## 7) COO(n ## 8, f ## 8) COO(n ## 9, f ## 9) 18 #define COO100(n,f) COO10(n ## 0, f ## 0) COO10(n ## 1, f ## 1) COO10(n ## 2, f ## 2) COO10(n ## 3, f ## 3) COO10(n ## 4, f ## 4) COO10(n ## 5, f ## 5) COO10(n ## 6, f ## 6) COO10(n ## 7, f ## 7) COO10(n ## 8, f ## 8) COO10(n ## 9, f ## 9) 19 20 int foo(int i) 21 { 22 struct X *p = 0; 23 x000.i = 0; 24 x599.j = 0; 25 switch (i) 26 { 27 COO100(1, x0) 28 COO100(2, x1) 29 COO100(3, x2) 30 COO100(4, x3) 31 COO100(5, x4) 32 COO100(6, x5) 33 COO100(7, x6) 34 COO100(8, x7) 35 COO100(9, x8) 36 COO100(10, x9) 37 } 38 return p->j; 39 } 40