c - Looping construct in a C99 macro -
i want generate array initializer arbitrary logic unfortunately requires looping.
#define random_array(n) \ ... double array[] = random_array(10);
suppose code above generates initializer 10-element array. possible define such macro (with loop) in c99 ?
nb: doesn't have macro if function call suffice (but has possible call among global initializers, not in second function);
the c preprocessor doesn't support loops, want not (easily) possible.
i added '(easily)' because there ways loop-like behavior using boost's iterate. uses recursive file inclusion emulate loop. i'm not sure if want go far.
Comments
Post a Comment