From Jason Turner

[cpp.replace.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmplvmcpk7c/{from.md → to.md} +11 -5
tmp/tmplvmcpk7c/{from.md → to.md} RENAMED
@@ -60,10 +60,16 @@ The identifier immediately following the `define` is called the *macro
60
  name*. There is one name space for macro names. Any whitespace
61
  characters preceding or following the replacement list of preprocessing
62
  tokens are not considered part of the replacement list for either form
63
  of macro.
64
 
 
 
 
 
 
 
65
  If a `#` preprocessing token, followed by an identifier, occurs
66
  lexically at the point at which a preprocessing directive can begin, the
67
  identifier is not subject to macro replacement.
68
 
69
  A preprocessing directive of the form
@@ -71,17 +77,17 @@ A preprocessing directive of the form
71
  ``` bnf
72
  '# define' identifier replacement-list new-line
73
  ```
74
 
75
  defines an *object-like macro* that causes each subsequent instance of
76
- the macro name[^5]
77
 
78
  to be replaced by the replacement list of preprocessing tokens that
79
- constitute the remainder of the directive.[^6]
80
 
81
  The replacement list is then rescanned for more macro names as specified
82
- below.
83
 
84
  [*Example 2*:
85
 
86
  The simplest use of this facility is to define a “manifest constant”, as
87
  in
@@ -117,13 +123,13 @@ The sequence of preprocessing tokens bounded by the outside-most
117
  matching parentheses forms the list of arguments for the function-like
118
  macro. The individual arguments within the list are separated by comma
119
  preprocessing tokens, but comma preprocessing tokens between matching
120
  inner parentheses do not separate arguments. If there are sequences of
121
  preprocessing tokens within the list of arguments that would otherwise
122
- act as preprocessing directives,[^7]
123
 
124
- the behavior is undefined.
125
 
126
  [*Example 3*:
127
 
128
  The following defines a function-like macro whose value is the maximum
129
  of its arguments. It has the disadvantages of evaluating one or the
 
60
  name*. There is one name space for macro names. Any whitespace
61
  characters preceding or following the replacement list of preprocessing
62
  tokens are not considered part of the replacement list for either form
63
  of macro.
64
 
65
+ A translation unit shall not `#define` or `#undef` macro names lexically
66
+ identical to keywords, to the identifiers listed in
67
+ [[lex.name.special]], or to the *attribute-token*s described in 
68
+ [[dcl.attr]], except that the macro names `likely` and `unlikely` may be
69
+ defined as function-like macros.
70
+
71
  If a `#` preprocessing token, followed by an identifier, occurs
72
  lexically at the point at which a preprocessing directive can begin, the
73
  identifier is not subject to macro replacement.
74
 
75
  A preprocessing directive of the form
 
77
  ``` bnf
78
  '# define' identifier replacement-list new-line
79
  ```
80
 
81
  defines an *object-like macro* that causes each subsequent instance of
82
+ the macro name[^4]
83
 
84
  to be replaced by the replacement list of preprocessing tokens that
85
+ constitute the remainder of the directive.[^5]
86
 
87
  The replacement list is then rescanned for more macro names as specified
88
+ in [[cpp.rescan]].
89
 
90
  [*Example 2*:
91
 
92
  The simplest use of this facility is to define a “manifest constant”, as
93
  in
 
123
  matching parentheses forms the list of arguments for the function-like
124
  macro. The individual arguments within the list are separated by comma
125
  preprocessing tokens, but comma preprocessing tokens between matching
126
  inner parentheses do not separate arguments. If there are sequences of
127
  preprocessing tokens within the list of arguments that would otherwise
128
+ act as preprocessing directives,[^6]
129
 
130
+ the program is ill-formed.
131
 
132
  [*Example 3*:
133
 
134
  The following defines a function-like macro whose value is the maximum
135
  of its arguments. It has the disadvantages of evaluating one or the