home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!sun-barr!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!news.udel.edu!perelandra.cms.udel.edu!mccalpin
- From: mccalpin@perelandra.cms.udel.edu (John D. McCalpin)
- Subject: Re: How does one return a logical value...???
- Message-ID: <Bxx13D.L74@news.udel.edu>
- Sender: usenet@news.udel.edu
- Nntp-Posting-Host: perelandra.cms.udel.edu
- Organization: College of Marine Studies, U. Del.
- References: <BxwrJC.GME@cs.uiuc.edu>
- Date: Wed, 18 Nov 1992 14:18:49 GMT
- Lines: 37
-
- In article <BxwrJC.GME@cs.uiuc.edu> ctaylor@cs.uiuc.edu (Conrad W Taylor) writes:
- > I have written a function which returns a logical
- >value, CheckActivity(previous, ROWS, COLS), previous is an
- >array. I'm using it like this:
- >
- > IF (CheckActivity(previous, ROWS, COLS) .EQ. .TRUE.) THEN
- > uncontrol = uncontrol + 1
- > ENDIF
- >
- >My compiler says that I have mixed types when I use .TRUE.
-
- This is a very common mistake. The FORTRAN-77 standard only allows
- numeric and string operands for the .EQ. operator. You must use
- the .EQV. operator for logical operands.
-
- Of course, there is no need for an operator at all here, since you can
- just omit the predicate and use:
-
- IF (CheckActivity(previous, ROWS, COLS)) THEN
- uncontrol = uncontrol + 1
- ENDIF
-
-
- The use of .EQ. for logical operands is a fairly common extension.
- Sun and Silicon Graphics allow it. IBM (xlf) disallows it with a
- surprisingly clear error message. Cray (cft77) disallows it with
- a rather obscure error message.
-
-
- P.S. Conrad, you should get your news posting software fixed!
- Your e-mail address ctaylor@cs.uiuc.edu is not recognized by
- cs.uiuc.edu.
- --
- --
- John D. McCalpin mccalpin@perelandra.cms.udel.edu
- Assistant Professor mccalpin@brahms.udel.edu
- College of Marine Studies, U. Del. John.McCalpin@mvs.udel.edu
-