You can use Order-PP for this if you desperately need.
This is a scripting language implemented in the preprocessor. This means that it is conceptually similar to using a scripting language to generate C code (in fact, the same), except that there are no external tools, and the script is executed simultaneously with the C compiler: everything is executed using C macros. Despite the fact that it is built on a preprocessor, there are no real restrictions for cyclic iterations, recursion depths or anything like that (the limit is somewhere in the billions, you do not need to worry about that).
To fix the code requested in the sample question, you can write:
#include <order/interpreter.h> ORDER_PP( // runs Order code 8for_each_in_range(8fn(8I, 8print( 8cat(8(const int arr_len_), 8I) ([) 8I (] = {) 8I (};) )), 1, 101) )
I canβt understand why you will do this, instead of just integrating an external language such as Python into your build process (the order can be implemented using macros, but it still needs a separate language), but there is an option.
The order only works with GCC, as far as I know; other preprocessors exit the stack too quickly (even Clang) or do not conform to the standard.
Leushenko
source share