G
Guest
In C++ I want to statically create an array that contains variable arrays
inside of it. Or something similar.
Essentially I want to do something like this:
{
{"name1", {a, b, c} },
{"name2", {b, c} },
{"name2", {d} }
}
I want an array of names, and with each name I want to associate an list of
characteristics., of unknown size. But this will all be known at compile
time, so it is a static list.
Or the equivalent. It seems to be that this should be possible with the
compiler.
Worst case scenario I can always do:
int *foo[] = {a, b, c};
{"name1", foo}, etc...
But that seems like too much work on my part. The compiler should be able to
do this work.
If I do the obvious and declare flexible arrays I get a warning about a
nonstandard extension. Then an error "arrays of objects containing zero-size
arrays are illegal"
Thanks
inside of it. Or something similar.
Essentially I want to do something like this:
{
{"name1", {a, b, c} },
{"name2", {b, c} },
{"name2", {d} }
}
I want an array of names, and with each name I want to associate an list of
characteristics., of unknown size. But this will all be known at compile
time, so it is a static list.
Or the equivalent. It seems to be that this should be possible with the
compiler.
Worst case scenario I can always do:
int *foo[] = {a, b, c};
{"name1", foo}, etc...
But that seems like too much work on my part. The compiler should be able to
do this work.
If I do the obvious and declare flexible arrays I get a warning about a
nonstandard extension. Then an error "arrays of objects containing zero-size
arrays are illegal"
Thanks