'struct' - declarations & parameters

chris at umcp-cs.UUCP chris at umcp-cs.UUCP
Tue Feb 21 08:34:23 AEST 1984

Well first off, writing

	struct { int i, j, k; } foo = { 1, 2, 3 };

	main () { printf ("%d %d %d\n", foo); }

is just plain illegal.  The bit about unions is also illegal.  If you
must pass a union, do something like

	union xyzzy { char *c; int i; };
	main () {
		char *s;
			union xyzzy temp;
			temp.c = s;
			strange (temp, 1);

(This should be lots of fun for me: Gosling Emacs uses that union
trick for the first parameter to DefMac.  *Sigh*)

As to whether the trailing semicolon is required in structure
declarations:  all I can say is it doesn't hurt to use it.  (Though
if you want type declarations to match function declarations, it
should be optional.  I don't have to write "dummy () { ; }".)
In-Real-Life: Chris Torek, Univ of MD Comp Sci
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris.umcp-cs at CSNet-Relay

More information about the Comp.lang.c mailing list