Newsgroups: comp.lang.dylan,comp.lang.lisp,comp.lang.java
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsfeed.cit.cornell.edu!newsstand.cit.cornell.edu!news.kei.com!simtel!chi-news.cic.net!uwm.edu!spool.mu.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!NewsWatcher!user
From: hbaker@netcom.com (Henry Baker)
Subject: Re: Garbage collection cost (was Re: Parenthesized syntax challenge)
Message-ID: <hbaker-3110951715350001@10.0.2.15>
Sender: hbaker@netcom5.netcom.com
Organization: nil organization
References: <44aa9a$j5h@miso.cs.uq.edu.au> <LUDEMANN.95Oct6140930@expernet26.expernet.com> <DGApp8.J41@undergrad.math.uwaterloo.ca> <MAD.95Oct13123618@tanzanite.math.keio.ac.jp> <45ksdk$7gr@jive.cs.utexas.edu> <DGJp8o.7nF@Cadence.COM> <MAD.95Oct18040436@tanzanite.math.keio.ac.jp> <hbaker-1710952127200001@10.0.2.15> <46jb8v$sm8@news.parc.xerox.com> <hbaker-2510951016220001@10.0.2.15> <46rkuv$jh8@news.parc.xerox.com> <hbaker-2810950832030001@10.0.2.15> <474fku$mej@news.parc.xerox.com>
Date: Wed, 1 Nov 1995 01:15:35 GMT
Lines: 32
Xref: glinda.oz.cs.cmu.edu comp.lang.dylan:5772 comp.lang.lisp:19804 comp.lang.java:3371

In article <474fku$mej@news.parc.xerox.com>, boehm@parc.xerox.com (Hans
Boehm) wrote:

> Maybe I'm missing something.  Consider
> 
> union U {
>     int x;
>     union U * y;
> }
> 
> Assume a and b have type (union U *).  How do you compile 
> 
> *a = *b;
> 
> A straight copy won't work if *b was last assigned with the pointer variant.
> Adjusting for the difference between a and b will break if they both have
> the integer variant.

I don't think that C guarantees _anything_ about unions of pointers and
ints.  I don't think that C guarantees much about unions at all.  Most C
compilers seem to handle union assignments as if they were the first
member of the union, or that they are bit strings as
long as the longest member.  But there are lots of things that break with
unions.

C should never allow assignments of union types; they should only
allow assignments of the members.  Not only does this keep the compiler
from getting confused, it also keeps the _programmer_ from getting confused.

-- 
www/ftp directory:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html
