Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!hplabs!hpfcso!cunniff From: cunniff@hpfcso.HP.COM (Ross Cunniff) Newsgroups: comp.lang.fortran Subject: Re: What is the FORTRAN for ? Message-ID: <9080007@hpfcso.HP.COM> Date: 29 Aug 90 15:01:21 GMT References: <1990Jul25.174153.16896@ecn.purdue.edu> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 40 >> ... Beyond the requirement that LOGICAL variables take the >>same amount of storage as INTEGER and REAL variables, the standard >>places no restrictions on the internal representation and there is >>no single "best" way to implement the type. For example, one >>implementation may focus on the least significant bit, using 0 for >>.FALSE. and 1 for .TRUE. Another may focus instead on the sign >>bit, using +1 for .FALSE. and -1 for .TRUE. ... > > The universal convention, so far as I know, is that .FALSE. is > always represented by all bits zero, while *any* bit on must be > recognized as .TRUE. and detected by the code generated by a > conforming compiler. Switching must always be done by moving a > full word (or whatever) of zero bits into a variable to set it > .FALSE., or a full word or whatever containing at least one one > bit to set it .TRUE., never by clever bit flipping. Well, no. Take the following code fragment: logical l integer i equivalence (l,i) i = 2 print *, l end This results in the following output: T (HP9000 Series 300 workstation) F (HP3000 minicomputer) F (DEC VAX) Most UN*X compilers apply the same rule you quoted; however, there are quite a few non-UN*X compilers out there. Lest you think that, just because this is not a standard conforming program, there is no problem, consider the fact that most UN*X compilers have an option to treat logicals as the VAX does... Ross Cunniff Hewlett-Packard Colorado Language Lab cunniff@hpfcla.hp.com