News for hackers. Stuff that matters.
Re:My Favorite C++ Pattern: X Macros (2023) by yason on Wednesday March 26, 2025 @07:47AM (#43481141)
Using the C preprocessor is standard, available, compatible and the major usage patterns are "known". For a lot of cases, they're way easier to reason about rather than learning how an external generation tool is used to generate the code. In order to understand these macros all I need is to read the source code where they're used.

Nothing C++ related in the pattern though. This C preprocessor trickery is practically so classic you couldn't necessarily even call it a "trick".

There are no comments on this comment yet.