2021-04-15: PP_LOOP
PP_LOOP is a pre-processor loop, so generates multiple blocks of code. For example:
Will compile as:
The definition of this macro is:
The separator goes BETWEEN instances of ?output?, but not at the end. So you can make a list as:
And that will compile as:
Note the lack of ?, ? on the end because that?s not separating anything.
PP_LOOP is a pre-processor loop, so generates multiple blocks of code. For example:
Quote:
PP_LOOP<5>(printf("hi");)()
Will compile as:
Quote:
printf("hi");printf("hi");printf("hi");printf("hi");printf("hi");
The definition of this macro is:
Quote:
PP_LOOP<loop count>(output)(separator)
The separator goes BETWEEN instances of ?output?, but not at the end. So you can make a list as:
Quote:
PP_LOOP<10>(55)(, )
And that will compile as:
Quote:
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
Note the lack of ?, ? on the end because that?s not separating anything.