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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -