Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin From: hrubin@pop.stat.purdue.edu (Herman Rubin) Newsgroups: comp.lang.fortran Subject: Re: Cheating on the types Summary: One of the problems with HLLs Message-ID: <8421@mentor.cc.purdue.edu> Date: 21 Mar 91 15:54:56 GMT References: <1991Mar20.195732.15376@appmag.com> <10146@exodus.Eng.Sun.COM> Sender: news@mentor.cc.purdue.edu Lines: 40 In article <10146@exodus.Eng.Sun.COM>, wsb@boise.Eng.Sun.COM (Walt Brainerd) writes: > 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. > > real rin, rout > > call icopy(rin, rout) > . . . > > subroutine icopy(iin, iout) > > integer iin, iout > > Seems fairly innocuous, though. Q: are there implementations > > where it would fail ? > Yes. > The Burroughs linkers on their old large systems B6700-B7900, etc. > used to catch this. I don't know what they do now about such > things, but I think the trend is to do more checking of this > sort along with global oprimization, so I would not recommend > doing this (or anything else nonstandard) unless you really > need to. I have, using Fortran, deliberately set up subroutines which "cheated" on types. How else would one read multiple precision reals in or out? I do not consider converting them to decimal for output, or reading in decimal input, as reasonable; I wanted to be sure that the numbers were exactly the machine numbers, and I see no good reason to do unnecessary conversions. There are also cases in which I have deliberately done boolean operations on "real" numbers. The language designer, etc., who does not allow someone to deliberately cheat on the types is doing a great disservice to computing. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (Internet, bitnet) {purdue,pur-ee}!l.cc!hrubin(UUCP)