Unions w/o struct a crock? NO!

mat at hou5d.UUCP mat at hou5d.UUCP
Tue Apr 10 06:19:09 AEST 1984


Are unions outside of structs a crock?  Well, there is one important
situation where they are used.  The system II and system V YACC parsers
allow arbitrary objects to be passed on the value stack;  consistancy
is insured by declarations of types represented by terminals and by a
rather weird syntax.  This is only feasible with unions and the unions
(unlike variant records) need no discriminant, so there is no surrounding
struct.

Why, oh why saddle a useful construct like the union with a problem-dependent
restriction like discriminants?  Why go out of your way to make something
simple into something troublesome by adding combersome restrictions that are
not universally necessary?

-- 

					from Mole End
					Mark Terribile
		     (scrape..dig)	hou5d!mat
    ,..      .,,       ,,,   ..,***_*.



More information about the Comp.lang.c mailing list