Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.lang.c Subject: Re: Union type conversions Message-ID: <1180@mcgill-vision.UUCP> Date: 25 Jun 88 05:35:18 GMT References: <5754@bloom-beacon.MIT.EDU> Organization: McGill University, Montreal Lines: 26 In article <5754@bloom-beacon.MIT.EDU>, tada@athena.mit.edu (Michael Zehr) writes: > So what it boils down to, is whether casting into a union type is > legal and portable Ouch. I just searched through K&R V2 for a description of what may be cast to what. Nowhere did I find anything that comes right out and *says* you can't cast to an aggregate type. However, I also found nothing explicitly requiring it to even compile, much less work. Casting a type to a union which has a member of that type is certainly a reasonable operation. However, so are many other things which aren't allowed, such as comparing aggregate types for equality.... Legal or not, I think we can be confident it isn't portable. Could someone with a copy of the draft standard say just how much latitude it allows on this point? > (i don't want to just play with it til it works and then discover > that it only works by accident on my compiler :-). If only everyone were so sensible. der Mouse uucp: mouse@mcgill-vision.uucp arpa: mouse@larry.mcrcim.mcgill.edu