From Jason Turner

[cpp.rescan]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppqg1h3zx/{from.md → to.md} +38 -0
tmp/tmppqg1h3zx/{from.md → to.md} RENAMED
@@ -4,10 +4,48 @@ After all parameters in the replacement list have been substituted and
4
  `#` and `##` processing has taken place, all placemarker preprocessing
5
  tokens are removed. Then the resulting preprocessing token sequence is
6
  rescanned, along with all subsequent preprocessing tokens of the source
7
  file, for more macro names to replace.
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  If the name of the macro being replaced is found during this scan of the
10
  replacement list (not including the rest of the source file’s
11
  preprocessing tokens), it is not replaced. Furthermore, if any nested
12
  replacements encounter the name of the macro being replaced, it is not
13
  replaced. These nonreplaced macro name preprocessing tokens are no
 
4
  `#` and `##` processing has taken place, all placemarker preprocessing
5
  tokens are removed. Then the resulting preprocessing token sequence is
6
  rescanned, along with all subsequent preprocessing tokens of the source
7
  file, for more macro names to replace.
8
 
9
+ [*Example 1*:
10
+
11
+ The sequence
12
+
13
+ ``` cpp
14
+ #define x 3
15
+ #define f(a) f(x * (a))
16
+ #undef x
17
+ #define x 2
18
+ #define g f
19
+ #define z z[0]
20
+ #define h g(~
21
+ #define m(a) a(w)
22
+ #define w 0,1
23
+ #define t(a) a
24
+ #define p() int
25
+ #define q(x) x
26
+ #define r(x,y) x ## y
27
+ #define str(x) # x
28
+
29
+ f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
30
+ g(x+(3,4)-w) | h 5) & m
31
+ (f)^m(m);
32
+ p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
33
+ char c[2][6] = { str(hello), str() };
34
+ ```
35
+
36
+ results in
37
+
38
+ ``` cpp
39
+ f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
40
+ f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
41
+ int i[] = { 1, 23, 4, 5, };
42
+ char c[2][6] = { "hello", "" };
43
+ ```
44
+
45
+ — *end example*]
46
+
47
  If the name of the macro being replaced is found during this scan of the
48
  replacement list (not including the rest of the source file’s
49
  preprocessing tokens), it is not replaced. Furthermore, if any nested
50
  replacements encounter the name of the macro being replaced, it is not
51
  replaced. These nonreplaced macro name preprocessing tokens are no