...
Non-Compliant Code Example
The following definition for {{ Wiki Markup static_assert()
}} from \[[DCL03-A. Use a static assertion to test the value of a constant expression]] uses the {{JOIN()
}} macro to concatenate the token {{assertion_failed_at_line_
}} with the value of {{\_
\_LINE
\_
\_
}}.
Code Block |
---|
#define static_assert(e) \ typedef char JOIN(assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1] |
...
JOIN(x, y)
calls JOIN_AGAIN(x, y)
so that, if x
or y
is a macro, they are expanded before the ##
operator pastes them together.
Note also that macro parameters cannot be individually parenthesized when concatenating tokens using the {{ Wiki Markup ##
}} operator, converting macro parameters to strings using the {{#
}} operator, or concatenating adjacent string literals. This is an exception *PRE01-EX2* to \[[PRE01-A. Use parentheses within macros around parameter names]\].
Non-Compliant Code Example
...