tmp/tmp8rwmi9n3/{from.md → to.md}
RENAMED
|
@@ -6,11 +6,11 @@ end of a replacement list for either form of macro definition.
|
|
| 6 |
If, in the replacement list of a function-like macro, a parameter is
|
| 7 |
immediately preceded or followed by a `##` preprocessing token, the
|
| 8 |
parameter is replaced by the corresponding argument’s preprocessing
|
| 9 |
token sequence; however, if an argument consists of no preprocessing
|
| 10 |
tokens, the parameter is replaced by a placemarker preprocessing token
|
| 11 |
-
instead.[^
|
| 12 |
|
| 13 |
For both object-like and function-like macro invocations, before the
|
| 14 |
replacement list is reexamined for more macro names to replace, each
|
| 15 |
instance of a `##` preprocessing token in the replacement list (not from
|
| 16 |
an argument) is deleted and the preceding preprocessing token is
|
|
@@ -21,19 +21,20 @@ concatenation of a placemarker with a non-placemarker preprocessing
|
|
| 21 |
token results in the non-placemarker preprocessing token. If the result
|
| 22 |
is not a valid preprocessing token, the behavior is undefined. The
|
| 23 |
resulting token is available for further macro replacement. The order of
|
| 24 |
evaluation of `##` operators is unspecified.
|
| 25 |
|
|
|
|
|
|
|
| 26 |
In the following fragment:
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
#define hash_hash # ## #
|
| 30 |
#define mkstr(a) # a
|
| 31 |
#define in_between(a) mkstr(a)
|
| 32 |
#define join(c, d) in_between(c hash_hash d)
|
| 33 |
-
char p[] = join(x, y); // equivalent to
|
| 34 |
-
// char p[] = "x ## y";
|
| 35 |
```
|
| 36 |
|
| 37 |
The expansion produces, at various stages:
|
| 38 |
|
| 39 |
``` cpp
|
|
@@ -46,5 +47,7 @@ mkstr(x ## y)
|
|
| 46 |
|
| 47 |
In other words, expanding `hash_hash` produces a new token, consisting
|
| 48 |
of two adjacent sharp signs, but this new token is not the `##`
|
| 49 |
operator.
|
| 50 |
|
|
|
|
|
|
|
|
|
| 6 |
If, in the replacement list of a function-like macro, a parameter is
|
| 7 |
immediately preceded or followed by a `##` preprocessing token, the
|
| 8 |
parameter is replaced by the corresponding argument’s preprocessing
|
| 9 |
token sequence; however, if an argument consists of no preprocessing
|
| 10 |
tokens, the parameter is replaced by a placemarker preprocessing token
|
| 11 |
+
instead.[^8]
|
| 12 |
|
| 13 |
For both object-like and function-like macro invocations, before the
|
| 14 |
replacement list is reexamined for more macro names to replace, each
|
| 15 |
instance of a `##` preprocessing token in the replacement list (not from
|
| 16 |
an argument) is deleted and the preceding preprocessing token is
|
|
|
|
| 21 |
token results in the non-placemarker preprocessing token. If the result
|
| 22 |
is not a valid preprocessing token, the behavior is undefined. The
|
| 23 |
resulting token is available for further macro replacement. The order of
|
| 24 |
evaluation of `##` operators is unspecified.
|
| 25 |
|
| 26 |
+
[*Example 1*:
|
| 27 |
+
|
| 28 |
In the following fragment:
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
#define hash_hash # ## #
|
| 32 |
#define mkstr(a) # a
|
| 33 |
#define in_between(a) mkstr(a)
|
| 34 |
#define join(c, d) in_between(c hash_hash d)
|
| 35 |
+
char p[] = join(x, y); // equivalent to char p[] = "x ## y";
|
|
|
|
| 36 |
```
|
| 37 |
|
| 38 |
The expansion produces, at various stages:
|
| 39 |
|
| 40 |
``` cpp
|
|
|
|
| 47 |
|
| 48 |
In other words, expanding `hash_hash` produces a new token, consisting
|
| 49 |
of two adjacent sharp signs, but this new token is not the `##`
|
| 50 |
operator.
|
| 51 |
|
| 52 |
+
— *end example*]
|
| 53 |
+
|