Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!husc6!panda!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!ucla-cs!gast From: gast@ucla-cs.ARPA (David Gast) Newsgroups: net.lang.f77 Subject: Re: f77 bug: comparing logicals Message-ID: <12846@ucla-cs.ARPA> Date: Wed, 7-May-86 22:28:27 EDT Article-I.D.: ucla-cs.12846 Posted: Wed May 7 22:28:27 1986 Date-Received: Sun, 11-May-86 03:33:01 EDT References: <464@cubsvax.UUCP> Reply-To: gast@ucla-cs.UUCP (David Gast) Organization: UCLA Computer Science Dept. Lines: 43 In article <464@cubsvax.UUCP> peters@cubsvax.UUCP (Peter S. Shenkin) writes: >The following program, compiled with f77, prints "f" for all three >comparisons; under VMS, using dec fortran, the three results are >"T", "F" and "T", as one would expect. > >cccccccccccccccccccccccc BEGIN HERE ccccccccccccccccccccccccccccccccccccccc > write(6,*)'.true. .eq. .true. :', .true. .eq. .true. > write(6,*)'.true. .eq. .false. :', .true. .eq. .false. > write(6,*)'.false. .eq. .false. :', .false. .eq. .false. > > stop > end >cccccccccccccccccccccccc END HERE cccccccccccccccccccccccccccccccccccccccccc When will you guys learn? The way to figure out what the language requires is not to write a program and see what the compiler does, but to read the language definition and see what is required. Surely, by now, you must have all seen some program where the compiler makes a mistake. For those of you who are blind, the example at hand will suffice. Not relying on the compiler is particularly true for FORTRAN. In the first place, F77 looks a lot like its older brothers, but its semantics are quite different. For example, boolean short circuit evaluation is permitted, but not required. Second, no matter what the compiler manual says, the compiler does not enforce the F77 standard (or the earlier ones). This statement applies to the UN*X F77 compiler and to the IBM VFORTRAN compiler, for example. (The IBM manual also contains statements which are blatantly incorrect, as well). Perhaps some day, I will post a F77 program that has an error on almost every line--the compilers and the run-time system do not catch or flag or warn about any of them. Now to the example at hand. F77 does not allow the .eq. operator between logicals. There is a syntax error not detected by the compiler. Isn't FORTRAN a great language? If you are tired of crap like this, I suggest you throw your FORTRAN compiler out, and get an ALGOL 68 compiler. You won't even have to worry about unitialized values. And who knows, your program might actually even work. David Gast gast@CS.UCLA.EDU