On Friday, 21 July 2017 at 19:26:05 UTC, Johan Engelen wrote:
On Thursday, 20 July 2017 at 21:17:45 UTC, Walter Bright wrote:
Some time ago, I wrote about the X Macro in C:

  https://digitalmars.com/articles/b51.html

I used it from time to time in C code. It's one of the things I actually like about the C preprocessor. But in translating the aged C code to D it was time to make X work in D. Here's the C code, followed by the D translation.

This mechanism is used in LLVM in a number of places, where the list entries are used e.g. to populate tables and to define aggregate member fields.
For example:
https://github.com/llvm-mirror/compiler-rt/blob/master/lib/profile/InstrProfData.inc#L29-L51

And those in turn are generated from TableGen.

Reply via email to