• Create Account

### #ActualWashu

Posted 23 October 2012 - 02:15 PM

Out of curiosity I'm guessing it was left out of the C++11 standard do to ambiguous naming as functions/variables would live in an unnamed inner scope?

In the anonymous case:

void f() {
union {
struct { int x, y; };
struct { int x, y; };
} u;
}


In the not so anonymous case its harder to come up with the same example, but there are similar issues.

I should note that the only places I've actually seen people use anonymous unions/structures was usually almost always a hack that could have been avoided.

### #1Washu

Posted 23 October 2012 - 02:13 PM

Out of curiosity I'm guessing it was left out of the C++11 standard do to ambiguous naming as functions/variables would live in an unnamed inner scope?

In the anonymous case:

void f() {
union {
struct { int x, y; };
struct { int x, y; };
} u;
}


In the not so anonymous case its harder to come up with the same example, but there are similar issues.

PARTNERS