[gclist] C++ proposal

Fergus Henderson fjh@cs.mu.OZ.AU
Wed, 29 May 1996 22:14:15 +1000 (EST)


Stefan Monnier, you wrote:
> 
> > A special and difficult issue is how to handle a union with a pointer
> > and a non-pointer member. Consider:
> 
> I always thought that the 'definition' of "union" makes it semantically
> equal to "struct". It's only the intended meaning which differs. In other
> words, "union" is only a hint to the compiler that only one of the entries
> inside the union will be used at a time.

You thought wrong.  There are a number of important semantic
differences, including the requirement that all members of a union have
the same address (or rather that the address of a union member, suitably
converted, points to the union -- and vice versa.)

But even if you were right, it wouldn't make much difference, because
the need for backwards binary compatibility would prevent C compiler
vendors from radically changing their representation of unions.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.