home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!decwrl!world!ksr!tim
- From: tim@ksr.com (Tim Peters)
- Newsgroups: comp.lang.fortran
- Subject: Re: Function declaration query
- Message-ID: <14777@ksr.com>
- Date: 13 Aug 92 20:33:47 GMT
- Article-I.D.: ksr.14777
- References: <1992Aug11.203411.24268@ctr.columbia.edu>
- Sender: news@ksr.com
- Organization: Kendall Square Research Corp.
- Lines: 33
-
- In article <1992Aug11.203411.24268@ctr.columbia.edu> shenkin@avogadro.barnard.columbia.edu (Peter S. Shenkin) writes:
- >I have a function that looks pretty much like this:
- >
- > LOGICAL FUNCTION FOO
- > COMMON/STUFF/....
- >C *** based on things in common, set FOO to .TRUE. or .FALSE.
- > RETURN
- > END
- >
- >[... IBM RS6000's xlf compiler gripes, requiring
- LOGICAL FUNCTION FOO()
- instead ...]
- >I was under the impression that the declaration as I originally wrote it
- >was standard-conforming; can someone tell me if I am correct?
-
- The F77 std requires parens for FUNCTION declarations but not for
- SUBROUTINE declarations. So xlf is doing you a favor <grin>.
-
- A curious thing about F77 is that while it restricts variable names to 6
- characters, the syntax nowhere *relies* on that. Since blanks are
- insignificant, your original line:
-
- LOGICAL FUNCTION FOO
-
- is ambiguous (i.e., are you declaring the LOGICAL function FOO or the
- LOGICAL variable FUNCTIONFOO?) without invoking the 6-character rule. A
- similar ambiguity cannot occur for SUBROUTINE statements, so F77 allows
- you to omit the parens for them.
-
- demonstrating-the-mind's-need-to-find-order-in-chaos-ly y'rs - tim
-
- Tim Peters Kendall Square Research Corp
- tim@ksr.com, ksr!tim@uunet.uu.net
-