Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!tuvie!nestroy!usenet From: tom@itc.univie.ac.at (Tom Kovar) Newsgroups: comp.lang.fortran Subject: Re: Cheating on the types Message-ID: <1991Mar28.220027.10553@nestroy.wu-wien.ac.at> Date: 28 Mar 91 22:00:27 GMT References: <1991Mar20.195732.15376@appmag.com> <4554@alliant.Alliant.COM> <1991Mar25.163447.10166@cl.cam.ac.uk> Sender: usenet@nestroy.wu-wien.ac.at (The Usenet User) Organization: Inst. of Theoretical Chemistry, University of Vienna Lines: 38 In article <1991Mar20.195732.15376@appmag.com> pa@appmag.com (Pierre Asselin) writes: }This simplified fragment violates the standard by passing reals to a }routine that expects integers. } } program wrong } real rin, rout } rin= 0.577215665 ! or whatever... } call icopy(rin, rout) } write(6,*) rout } end } } subroutine icopy(iin, iout) } integer iin, iout } iout= iin } return } end } }Seems fairly innocuous, though. Q: are there implementations }where it would fail ? > >From the mists of time: on TITAN (and other Atlas-1 and Atlas-2 Fortran >implementations as well, I expect) integers were halfwords (24 bits) while >reals were words (48 bits). The above code would not have worked. > >This implementation long preceded the Fortran 77 rules on storage units. >However, in some cases it was compatible with them: for example, an INTEGER >array and a REAL array with the same number of elements that were >EQUIVALENCEd or overlaid in COMMON would correspond 1:1 (half the space >in the INTEGER array was "wasted"). Copying the INTEGER array element by >element to another such INTEGER/REAL pair would not have the effect of >copying the REAL array (only half the bits would be moved), and there is >nothing in the Fortran 77 standard to say that it should. Another wonderfull thing - on old Telefunken TR440 (or something like that) using a 48 bit word, I think 2 bits were passed within the word, identifying the kind of the argument... So you would have been caught... :-) Tom Kovar