C
Christopher Benson-Manica
Is the following program conforming under C99?
#include <stdio.h>
typedef struct foo {
int bar;
int baz[];
} foo;
foo foos[]={
{ 1, {1,2,3} }
};
int main() {
return 0;
}
gcc -Wall -pedantic -std=c99 (3.3.3 for cygwin) accepts the program
without the declaration for the array of foo structs, but issues an
error about "initialization of a flexible array member in a nested
context" on the program above. Is it correct?
#include <stdio.h>
typedef struct foo {
int bar;
int baz[];
} foo;
foo foos[]={
{ 1, {1,2,3} }
};
int main() {
return 0;
}
gcc -Wall -pedantic -std=c99 (3.3.3 for cygwin) accepts the program
without the declaration for the array of foo structs, but issues an
error about "initialization of a flexible array member in a nested
context" on the program above. Is it correct?