Unions and structures

Henry Spencer henry at utzoo.UUCP
Tue Feb 26 04:00:40 AEST 1985


> 1) "structure reference must be addressable"

This one sounds like an out-and-out compiler bug, probably arising
because struct-returning functions were a very late addition to C.

> 2) "no automatic aggregate initialization"

Automatic aggregate initialization is definitely in ANSI C.

> ...  I'm also a little hacked that the compiler blows off
> register declarations for unions even when all members are the same
> size and fit in a register...

As you note later, this is a compiler problem.  It's not a trivial thing
to fix in some compilers, though, because there are deeply-ingrained
assumptions that unions are memory objects.  Yes, it would be nice, but
the odds that a large percentage of implementors will make the effort
are poor.  Some will, but not enough that you could count on it.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list