3 # define mustard(a,b) ((a) + b + a) /* 1, 2, 3, 4. no proto, 2 no parens, a used twice */
4 # define ketchup(a) (a) /* 5. no proto */
6 # define ok(a, b) ((a) + (b))
7 #define needparen(a, b) (a + b) /* 6, 7. no parens a and b */
8 # define needuse(a, b) (a) /* 8. b not used */
9 # define multuse(a, b) ((a) + (a) + (b)) /* 9. a used twice */
10 # define badassign(a,b) ((a) = (b)) /* 10. assignment to macro */
11 # define badassign(a,b) ((a)++, ++(b)) /* 11, 12, 13. badassign already defined,
14 # define predok(a,b) (((a) == 9) ? (b) : -(b))
15 # define predbad(a,b) (((a) == 8) ? (b) : -3) /* 14. b not used on false */
16 # define predbad2(a, b) (((a) == 2) ? (a) : (b) + (b)) /* 15, 16, 17. a used twice,
17 b used twice, not in true */
18 # define badorder(a,b) ((b)+(a)) /* ok */
19 # define okorder(a,b,c) (((a) == 2) ? (b) + (c) : (b) - (c))
20 # define okorder2(a,b,c) (((a) == 2) ? (((b) == 3) ? (c) : -(c)) : (b) - (c))
22 # define badval(a, b) ((a) == (b)) /* 18. return value */
23 # define badconst 5 /* 19. type */
24 # define goodconst ((5) == (3))
25 # define worseconst(a) ((a) == 7) /* 20. constant as parameterized macro */
27 # define var 5 /* 21. var as macro */
28 # define var2(x) ((x) + (x)) /* 22, 23. var as parameterized macro, x used twice */