X macro
C/C++ programming idiom
C/C++ programming idiom
X macros are an idiomatic usage of programming language macros for generating list-like structures of data or code. They are most useful when at least some of the lists cannot be composed by indexing, such as at compile time. They provide reliable maintenance of parallel lists whose corresponding items must be declared or executed in the same order. Examples of such lists include initializing arrays, along with declaring enumeration constants and function prototypes, generating statement sequences and switch arms, etc. Usage of X macros dates back to the 1960s. They remain useful in modern-day C and C++, yet are still relatively unknown.
Open boosters, collect cards and trade them. Free to play.
Play for free