I could use any help anyone could give for this. To write a piece of code, I need to strip out all the ANSI features (prototyping and whatnot). It is so I can use an HP-UNIX specific function or three. Anyway, I’m getting this error and I have no idea why:
error 1716: Automatic aggregate initialization is an ANSI feature.
It’s for a 2D array I have defined. What’s the problem and how do I fix it?
Thanks to all.
Oh, here is one of the arrays:
int m_d_array[MONTHS_IN_YEAR][MONTHS_IN_YEAR] =
{{ JANURARY, FEBRUARY, MARCH,
APRIL, MAY, JUNE,
JULY, AUGUST, SEPTEMBER,
OCTOBER, NOVEMBER, DECEMBER},
{ DAYS_IN_JANURARY, DAYS_IN_FEBRUARY,
DAYS_IN_MARCH, DAYS_IN_APRIL,
DAYS_IN_MAY, DAYS_IN_JUNE,
DAYS_IN_JULY, DAYS_IN_AUGUST,
DAYS_IN_SEPTEMBER, DAYS_IN_OCTOBER,
DAYS_IN_NOVEMBER, DAYS_IN_DECEMBER}};
It’s 12 by 12, and everything in it has a #define (the numbers used are sort of obvious.
who would have thought? maybe it was the static declaration space that fixed the problem. well… at least the error. thanks much. if anyone could tell me what that error actually meant, i would be most thankful.
If a variable isn’t static then it’s automatic.
If it’s made up of pieces, like an array or struct, then it’s an aggregate.
If you’re specifying a value in the declaration then you’re initializing.
You can do this in ANSI but not in standard C.
I don’t know why static vs non-static makes a difference, but I do know you have a much more blatant error: that’s not a 12x12 array. It’s a 2x12 array.