home *** CD-ROM | disk | FTP | other *** search
- Organization: Doctoral student, Industrial Administration, Carnegie Mellon, Pittsburgh, PA
- Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!br0w+
- Newsgroups: comp.lang.fortran
- Message-ID: <kf2iy2_00YUo8INXQF@andrew.cmu.edu>
- Date: Wed, 18 Nov 1992 20:36:02 -0500
- From: "Bruno W. Repetto" <br0w+@andrew.cmu.edu>
- Subject: Re: How does one return a logical value...???
- In-Reply-To: <BxwrJC.GME@cs.uiuc.edu>
- Lines: 49
-
- Excerpts from netnews.comp.lang.fortran: 18-Nov-92 How does one return a
- logic.. by Conrad W Taylor@cs.uiuc.
- > From: ctaylor@cs.uiuc.edu (Conrad W Taylor)
- > Subject: How does one return a logical value...???
- > Date: Wed, 18 Nov 1992 10:52:22 GMT
- >
- > I have written a function which returns a logical
- > value, CheckActivity(previous, ROWS, COLS), previous is an
- > array. I'm using it like this:
- >
- >
- > My compiler says that I have mixed types when I use .TRUE. . What
- > should I use I tried T instead of .TRUE. . It doesn't give errors
- > but it doesn't increment the uncontrol... it never goes into the
- > IF statement; skips it completely. I'm new to FORTRAN and please
- > if anyone knows what I should do, let me know via e-mail. Thanks
- > in advance to all that reply to my e-mail.
- >
- > -Conrad
- >
- >
-
- You should have the following in your calling (sub)program:
-
- logical CheckActivity
- .
- .
- .
- IF (CheckActivity(previous, ROWS, COLS) .EQ. .TRUE.) THEN
- uncontrol = uncontrol + 1
- ENDIF
- .
- .
- .
- And in your function declaration:
- logical function CheckActivity(... arguments...)
-
- The presence of the 'logical CheckActivity' declaration in the calling
- subprogram is required. If you compiled the two modules separately, and
- the calling subprogram didn't have the logical declaration, then the
- linker will link wierd code... Most compilers will notice if something
- is out of order if the modules are compiled in a single file, but will
- fail to warn you if they are compiled separately; you may or may not get
- a runtime error. Was this your case?
-
- My 2 rubber ningis worth. (Stolen from someone.)
-
- Bruno. br0w+@andrew.cmu.edu
-
-