I'm doing a program transformation from a language that allows expressions in array initializers to C99, which doesn't.
Currently, the way I'm handling this is to create an __arrayInit function and then generate a very large number of these inside:
array[0] = x + y * z; // Sample Expression
array[1] = a / b + c; // Another
array[2] = 5; // sometimes there's a constant
...
Often there are hundreds of these individual initializations. Is there a better way of doing this that executes faster? Kudos if it compiles faster as well.
Edit: The expressions are sometimes non-constant and can have variables and function calls in them.