Initialization of structs with unions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have this:

	struct mystruct {
		int a;
		union {
			int b;
			int c;
		};
	};

When I initialize it:

	struct mystruct implement = {
		.a = 1,
		.b = 2
	};

I get the following error from gcc:

error: unknown field `b' specified in initializer

Is it possible to do this kind of initialization alltogether? How can I initialize the anonymous union in the struct listed above?


Svein

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux