union *func()

Wade Guthrie evil at arcturus.UUCP
Wed Oct 26 03:58:58 AEST 1988


Is the following code portable, strictly conforming, etc.
	a = function()->member;
as in something like the following (really simplified) code:

	union yowza
	{	int	i;
		float	f;
		char	*c;
	};

	union yowza *yikes() /* actually, I pass the type here */
	{
		static union yowza fubar;
		fubar.i = 6; /* and I make the assignment based on
				the type */
		return (&fubar);
	}

	main()
	{	union yowza *yikes();
		int j;
		. . .
		j = yikes()->i;
	}
It works on (shudder) a VAX running VMS, and for this reason, I
suspect it is not portable -- can anyone help?


Wade Guthrie
Rockwell International
Anaheim, CA

(Rockwell doesn't necessarily believe / stand by what I'm saying; how could
they when *I* don't even know what I'm talking about???)



More information about the Comp.std.c mailing list