home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4360 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.1 KB  |  60 lines

  1. Organization: Doctoral student, Industrial Administration, Carnegie Mellon, Pittsburgh, PA
  2. Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!br0w+
  3. Newsgroups: comp.lang.fortran
  4. Message-ID: <kf2iy2_00YUo8INXQF@andrew.cmu.edu>
  5. Date: Wed, 18 Nov 1992 20:36:02 -0500 
  6. From: "Bruno W. Repetto" <br0w+@andrew.cmu.edu>
  7. Subject: Re: How does one return a logical value...???
  8. In-Reply-To: <BxwrJC.GME@cs.uiuc.edu>
  9. Lines: 49
  10.  
  11. Excerpts from netnews.comp.lang.fortran: 18-Nov-92 How does one return a
  12. logic.. by Conrad W Taylor@cs.uiuc. 
  13. > From: ctaylor@cs.uiuc.edu (Conrad W Taylor)
  14. > Subject: How does one return a logical value...???
  15. > Date: Wed, 18 Nov 1992 10:52:22 GMT
  16. >  
  17. >          I have written a function which returns a logical
  18. > value, CheckActivity(previous, ROWS, COLS), previous is an
  19. > array.  I'm using it like this:
  20. >  
  21. >  
  22. > My compiler says that I have mixed types when I use .TRUE. .  What
  23. > should I use I tried T instead of .TRUE. . It doesn't give errors
  24. > but it doesn't increment the uncontrol... it never goes into the
  25. > IF statement; skips it completely.  I'm new to FORTRAN and please
  26. > if anyone knows what I should do, let me know via e-mail.  Thanks
  27. > in advance to all that reply to my e-mail.
  28. >  
  29. > -Conrad
  30. >  
  31. >  
  32.  
  33. You should have the following in your calling (sub)program:
  34.  
  35.        logical CheckActivity
  36. .
  37. .
  38. .
  39.          IF (CheckActivity(previous, ROWS, COLS) .EQ.  .TRUE.) THEN
  40.            uncontrol = uncontrol + 1
  41.          ENDIF
  42. .
  43. .
  44. .
  45. And in your function declaration:
  46.        logical function CheckActivity(... arguments...)
  47.  
  48. The presence of the 'logical CheckActivity' declaration in the calling
  49. subprogram is required.  If you compiled the two modules separately, and
  50. the calling subprogram didn't have the logical declaration, then the
  51. linker will link wierd code... Most compilers will notice if something
  52. is out of order if the modules are compiled in a single file, but will
  53. fail to warn you if they are compiled separately; you may or may not get
  54. a runtime error.  Was this your case?
  55.  
  56. My 2 rubber ningis worth.  (Stolen from someone.)
  57.  
  58. Bruno. br0w+@andrew.cmu.edu
  59.  
  60.