Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!bionet!apple!sun-barr!newstop!sun!chiba!khb From: khb%chiba@Sun.COM (Keith Bierman - SPD Advanced Languages) Newsgroups: comp.lang.c,comp.sys.super Subject: Re: Type punning in C Message-ID: <126279@sun.Eng.Sun.COM> Date: 13 Oct 89 01:10:32 GMT References: <475@idacrd.UUCP> <1989Oct10.185851.6490@agate.berkeley.edu> <1989Oct11.091619.18336@gdt.bath.ac.uk> Sender: news@sun.Eng.Sun.COM Reply-To: khb@sun.UUCP (Keith Bierman - SPD Advanced Languages) Organization: Sun Microsystems, Mountain View Lines: 25 In article <1989Oct11.091619.18336@gdt.bath.ac.uk> exspes@gdr.bath.ac.uk (P E Smee) writes: >Problem is, the Fortran standard *also* says that if your program tries >to take the value of the variable using a different type than the type you >used when you last stored into it, your program is invalid. This is a >polite way of saying (to the user) 'this trick may not work', and (to >the My quick peek into the document (pages 8-3 and 17-1..4ish) doesn't make this obvious to me. Could you please quote chapter and verse ? > >Fortran equivalence was designed toallow reuse of storage on the early >small memory machines -- not to allow type punning. Usually you can >get away with punning, but it doesn't always work and so is a bad habit. > On which systems (if any) have you seen this not work ? Keith H. Bierman |*My thoughts are my own. !! kbierman@sun.com It's Not My Fault | MTS --Only my work belongs to Sun* I Voted for Bill & | Advanced Languages/Floating Point Group Opus | "When the going gets Weird .. the Weird turn PRO"