4 ms·
I gotta say what I really like about macros are that ( and )s are matched. If you say: while ($($cond:tt)*) { You'll actually match both while (true) {
by jD91mZM2 8y ago
I gotta say what I really like about macros are that ( and )s are matched. If you say:
while ($($cond:tt)*) {
You'll actually match both
while (true) {
and
while (5 * (2 + 3)) {
. It counts the parenthesis :D
- kazinator 8y agoEven C preprocessor macros count parenthesis. MAC((here, have one argument), and then this second one)
- dan-robertson 8y agoBut this is a requirement of the “you must be able to parse source code including macros without having to know how to expand macros” rule. Otherwise how would you know how to parse the following: foo!((x)) As foo! ( { ( x ) } ) Or foo! ( { ( x } ) ) With {} representing the argument to the macro.