Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!weyrich!orville From: orville@weyrich.UUCP (Orville R. Weyrich) Newsgroups: comp.lang.fortran Subject: Re: Pseudo-FORTRAN -- f2c for the Macintosh Message-ID: <1991Jun7.022834.898@weyrich.UUCP> Date: 7 Jun 91 02:28:34 GMT References: <1017@DIALix.oz.au> <1991Jun1.171914.802@weyrich.UUCP> <1991Jun5.220805.4653@alchemy.chem.utoronto.ca> Reply-To: orville@weyrich.UUCP (Orville R. Weyrich) Distribution: na Organization: Weyrich Computer Consulting Lines: 37 In article <1991Jun5.220805.4653@alchemy.chem.utoronto.ca> mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes: >In article <1991Jun1.171914.802@weyrich.UUCP> orville@weyrich.UUCP >(Orville R. Weyrich) writes: >[on using EQUIVALENCE with variables of differing types] >>This leads to the $500,000 question: do algorithms exist which can do something >>intelligent with such uses of EQUIVALENCE? >> >>YES, I WOULD BE VERY INTERESTED IN THE ANSWER TO THE ABOVE QUESTION. > >I can see one possible legitimate use of EQUIVALENCE with different data >types: to decide on the endianism of your machine (and similarly to decide >other quirks of the number system of the computer). You can load up some >variables with known values, equivalence them to appropriate-sized integers >and then use these integers to diagnose the endianism (round-off, etc.). Such >diagnostic toolkits are probably the only legitimate use of equivalence >across data types though (other than saving space). Anyone know any others? > Of course, you beg the question. Why do you need to know the endianism if you are writing standard FORTRAN? One of the design goals of standard FORTRAN is to describe how to write programs that are hardware-independent. Of course, practice is at odds with theory. In the real world, programmers need to do bit-twiddling (or at least they feel a need :-). Bit-twiddling is not supported by standard FORTRAN (66 & 77). To do it you need to resort to non-standard, machine-specific, non-portable games with EQUIVALENCE (or other mechanisms for aliasing memory). Support for bit-twiddling has been in and out of FORTRAN-9x several times. I haven't looked to see what its status is now. -------------------------------------- ****************************** Orville R. Weyrich, Jr., Ph.D. Certified Systems Professional Internet: orville%weyrich@uunet.uu.net Weyrich Computer Consulting Voice: (602) 391-0821 POB 5782, Scottsdale, AZ 85261 Fax: (602) 391-0023 (Yes! I'm available) -------------------------------------- ******************************