Structure question (problem)

Wayne A. Christopher faustus at ucbcad.UUCP
Wed May 29 08:11:45 AEST 1985


> its an implementation nightmare to have to init structures/arrays/unions

That is another thing that I would like to see in standard C -- initialization
of unions. You can't do it now, presumably because there are problems with
deciding which element you want to assign it to (although I can't really
see where the problems would come in...). If you write something like

union foo {
	int a;
	char *b;
	long c;
} bar[] = {
	{ 57 } ,
	{ (long) 76365 } ,
	{ "Hey, here we are" }
} ;

to initialize several unions, the compiler shouldn't have any trouble sseing
what you mean, right?

	Wayne



More information about the Comp.lang.c mailing list