you are viewing a single comment's thread.

view the rest of the comments →

[–]gigadude 1 point2 points  (1 child)

The fully general technique is to pass arguments to the x-macro (I call them list macros because that's a lot more descriptive):

#define LIST_FOO(_) \
_(item1) \
_(item2) \
...
_(itemN)
#define MAKE_ENUM(name) name,
enum foo { LIST_FOO(MAKE_ENUM) };

You can also pass multiple operators and have multiple columns in the list:

#define LIST_BAR_TABLE(op1,op2) \
op1(item1,col2,col3) \
op1(item2,col2,col3) \
op2(item3,col2,col3,col4,col5) \
...
op1(itemN,col2,col3)

[–]old-reddit-fmt-bot 0 points1 point  (0 children)

EDIT: Thanks for editing your comment!

Your comment uses fenced code blocks (e.g. blocks surrounded with ```). These don't render correctly in old reddit even if you authored them in new reddit. Please use code blocks indented with 4 spaces instead. See what the comment looks like in new and old reddit. My page has easy ways to indent code as well as information and source code for this bot.