On Mon, 2006-11-27 at 12:02 +1100, Brendon Costa wrote: > And apply the TYPE_MAIN_VARIANT on "Another", C++ returns Blah and C > again returns the anonymous RECORD_TYPE. In my situation this is causing > some grief as i need a consistent name for the main varient type across > translation units.
C and C++ have different rules about compatibilty of structs. C++ just mentions that the names have to be the same (and if the elements are different, the code violates the One Definition rule which means the code is invalid). For C, it does not talk about names, instead it mentions compatibility of struct based on the element layout. So what you are asking for is really not going to be the right thing. For full C rules you might able to read the function comptypes_internal in c-typeck.c or the C standard. In fact IIRC C99 has slightly different rules than C89. Thanks, Andrew Pinski