home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!usc!cs.utexas.edu!hermes.chpc.utexas.edu!michael
- From: michael@chpc.utexas.edu (Michael Lemke)
- Subject: Re: function name as an argument
- Message-ID: <1992Dec15.064208.21277@chpc.utexas.edu>
- Organization: The University of Texas System - CHPC
- References: <1992Dec14.193634.5231@newshost.lanl.gov> <1gj95eINNqgo@gap.caltech.edu> <1992Dec15.061743.20060@chpc.utexas.edu>
- Date: Tue, 15 Dec 92 06:42:08 GMT
- Lines: 69
-
- In article <1992Dec15.061743.20060@chpc.utexas.edu> michael@chpc.utexas.edu (Michael Lemke) writes:
- >In article <1gj95eINNqgo@gap.caltech.edu> shepard@sampson.ccsf.caltech.edu (Ron Shepard) writes:
- >>I believe that the following is standard f77.
- >
- > I don't think so -- see below.
- >
- [...]
- >> program dumb
- >> character*30 cvar
- >> character*(*) cfun
- >> external cfun
- [...]
-
- >>Upon execution on a couple of machines, I get:
- >>
- >>cvar=1234567890xxxxxxxxxxxxxxxxxxxx
- >>cvar=12345678901234567890xxxxxxxxxx
- >>
- >>which is what I thought I should get according to the previous discussion
- >>in this thread.
- >>
- >>Are there any machines that give different results?
- >
- > Yes, VAX/VMS:
- >
- >$ for x
- >%FORT-F-ADJLENUSE, Passed length character name used in invalid context
- > [CFUN] in module DUMB
- >%FORT-F-ENDNOOBJ, IO$DUC0:[MICHAEL]X.FOR;2 completed with 1 diagnostic - object
- >deleted
- >
- >So what junky Fortran took this?
- >
-
- I knew the Sun would take it! Just tried. That crap can also modify a
- parameter like so:
-
- Program dumber
- parameter( j = 77 )
-
- call foo( j )
-
- type *, j
- end
-
- subroutine foo( j )
-
- type *, 'foo> ', j
-
- j = 99
-
- type *, 'foo> ', j
-
- end
-
- Prints something like:
-
- foo> 77
- foo> 99
- 77
-
- At least J doesn't get changed in the main program. I think this should
- crash at the assignment to J in FOO. What say the Fortran lawyers here?
-
- Michael
- --
- Michael Lemke
- Astronomy, UT Austin, Texas
- (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
-