home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / fortran / 3021 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  1.6 KB

  1. Path: sparky!uunet!ogicse!decwrl!world!ksr!tim
  2. From: tim@ksr.com (Tim Peters)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Function declaration query
  5. Message-ID: <14777@ksr.com>
  6. Date: 13 Aug 92 20:33:47 GMT
  7. Article-I.D.: ksr.14777
  8. References: <1992Aug11.203411.24268@ctr.columbia.edu>
  9. Sender: news@ksr.com
  10. Organization: Kendall Square Research Corp.
  11. Lines: 33
  12.  
  13. In article <1992Aug11.203411.24268@ctr.columbia.edu> shenkin@avogadro.barnard.columbia.edu (Peter S. Shenkin) writes:
  14. >I have a function that looks pretty much like this:
  15. >
  16. >      LOGICAL FUNCTION FOO
  17. >      COMMON/STUFF/....
  18. >C     *** based on things in common, set FOO to .TRUE. or .FALSE.
  19. >      RETURN
  20. >      END
  21. >
  22. >[... IBM RS6000's xlf compiler gripes, requiring
  23.       LOGICAL FUNCTION FOO()
  24.   instead ...]
  25. >I was under the impression that the declaration as I originally wrote it
  26. >was standard-conforming;  can someone tell me if I am correct?
  27.  
  28. The F77 std requires parens for FUNCTION declarations but not for
  29. SUBROUTINE declarations.  So xlf is doing you a favor <grin>.
  30.  
  31. A curious thing about F77 is that while it restricts variable names to 6
  32. characters, the syntax nowhere *relies* on that.  Since blanks are
  33. insignificant, your original line:
  34.  
  35.       LOGICAL FUNCTION FOO
  36.  
  37. is ambiguous (i.e., are you declaring the LOGICAL function FOO or the
  38. LOGICAL variable FUNCTIONFOO?) without invoking the 6-character rule.  A
  39. similar ambiguity cannot occur for SUBROUTINE statements, so F77 allows
  40. you to omit the parens for them.
  41.  
  42. demonstrating-the-mind's-need-to-find-order-in-chaos-ly y'rs  - tim
  43.  
  44. Tim Peters   Kendall Square Research Corp
  45. tim@ksr.com,         ksr!tim@uunet.uu.net
  46.