Re:My Favorite C++ Pattern: X Macros (2023)
by writebetterc on Tuesday March 25, 2025 @11:13AM
(#43472340)
IDEs understand preprocessor macros, so IDE features (jump2def, etc) work with this. IDEs also can expand the macro invocations. So, I prefer the macros when possible :-).
[ Parent
| on HN ]
Re:My Favorite C++ Pattern: X Macros (2023)
by Someone on Tuesday March 25, 2025 @12:16PM
(#43473017)
> IDEs understand preprocessor macros, so IDE features (jump2def, etc) work with this.
Do they? X macros often are used with token pasting (https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html), as for example in (FTA)
#define AST_BEGIN_SUBCLASSES(NAME) START_##NAME ,
Are modern IDEs/compiler toolchains smart enough to tell you that START_foo was created by an expansion of that macro?