Is this legal in standard C or just a gcc feature?
Hi there
In gcc under cygwin I found I could do the following cleverness
##########
typedef struct {
int i;
int j;
Quote:
}MyStruct;
int main () {
int i;
i = ((MyStruct) { 3, 4 } ).j ;
printf("i= %d\n", i );
Quote:
}
##########
The program output as expected is
i = 4
However is this strictly legal C programming or just a gcc trick? I know
that Microsoft Visual Studio 6.0 compiler refuses to compile it and so does
the Diab PowerPC compiler from WindRiver.
Brad Phelan