This is a continuation of this issue .
I am trying to avoid using an explicit typedef to copy one array to another using such as:
#include <stdio.h>
int main(void)
{
int i;
int dst[] = { 10, 20, 30 }, src[] = { 1, 2, 3 };
*(struct{int _[3];}*)dst = *(struct{int _[3];}*)src;
for (i = 0; i < 3; i++) printf("%d\n", dst[i]);
return 0;
}
I get with gcc arrcpy.c:8: error: incompatible types in assignment, however with Open Watcom it compiles fine (and works as I expect, printing 1 to 3).
Is gcc behavior standard or not? If so, which chapter and section? I cannot understand why two identical type definitions struct{int _[3];}do not match (or are compatible) in gcc eyes.
EDIT . I know this is a bad coding style. The question is different. I am curious if there is a rationale for gcc behavior, if it is legal.