| | 1 | #define A(x) #x ## "hello" |
| | 2 | #define B(x) "hello" ## #x |
| | 3 | #define C(x,y) #x ## #y |
| | 4 | #define STR "hello" |
| | 5 | #define D(x) #x ## STR |
| | 6 | #define E(x) STR ## #x |
| | 7 | |
| | 8 | #define G(x) x ## STR |
| | 9 | #define H(x) STR ## x |
| | 10 | |
| | 11 | #define I(x) "hello" ## #x ## "goodbye" |
| | 12 | #define J(x, y) "Hello" ## #x ## #y ## "Goodbye" |
| | 13 | |
| | 14 | #define K(x) "Hello ## #x" |
| | 15 | |
| | 16 | #define L(x, y) x ## y |
| | 17 | |
| | 18 | #define PAREN_STR(a) "(" ## a ## ")" |
| | 19 | #define CONCAT(a, b) a ## b |
| | 20 | #define CONCAT_STR(a, b) #a ## #b |
| | 21 | #define DEBUG_PRINT(a) "value of " ## #a ## " = <<a>>" |
| | 22 | |
| | 23 | A: A(asdf); |
| | 24 | B: B(jklm); |
| | 25 | C: C(abc, def); |
| | 26 | D: D(xyz); |
| | 27 | E: E(ghi); |
| | 28 | |
| | 29 | G: G(abc); |
| | 30 | H: H(def); |
| | 31 | |
| | 32 | I: I(mnop); |
| | 33 | |
| | 34 | J: J(Tuv, Wxy); |
| | 35 | K: K(asfd); |
| | 36 | L: L("hello", "goodbye"); |
| | 37 | |
| | 38 | PAREN_STR("parens"); |
| | 39 | CONCAT("abc", "def"); |
| | 40 | CONCAT_STR(uvw, xyz); |
| | 41 | DEBUG_PRINT(obj.prop[3]); |