Anonymous Unions

Stan Katz stan@remote.control.com
Mon Nov 30 14:13:00 GMT 1998


Does gcc support the concept of anonymous unions. I am running V2.8.1
cross compiling from DOS (actually Windows) to Hitachi SH. Code that
compiles under other tools (BSO, Borland, VC). I define a structure
containing an unnamed union with 2 elements. The code refers to these
elements as if they were members of the structure. e.g.

struct Block {
	int		number;
	union {
		int	Value;
		char	*String;
		}
	struct block	*next;
	};
 
...

block.Value = 1;


 Under gcc this generates a warning : "unnamed struct/union that defines
no instances" and an error "structure  has no member named 'Value' ".

Anyone out there know of a compiler switch or something that will help,
or do I have to add a name for the union?

Stan Katz

_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.



More information about the crossgcc mailing list