P99

◆ P99_FOR
A preprocessor pseudo iterator.
In each iteration, FUNC will be called as OP is called for iterations 1 to N  1 to glue the results of the N iterations together. It is called in the form OP(NAME, I, REC, RES), where NAME and #define P00_SEP(NAME, I, REC, RES) REC; RES
#define P00_VASSIGN(NAME, X, I) X = (NAME)[I]
P99_FOR(A, 2, P00_SEP, P00_VASSIGN, toto, tutu);
Will result in toto = (A)[0]; tutu = (A)[1];
To understand the associativity of the OP argument #define P00_SUM(NAME, I, REC, RES) ((REC) + (RES))
#define P00_IDT(NAME, X, I) X
P99_FOR(A, 2, P00_SUM, P00_IDT, a, b, c)
Will result in ((((a) + (b))) + (c))
