home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / fortran / 4713 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.9 KB  |  80 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!usc!cs.utexas.edu!hermes.chpc.utexas.edu!michael
  3. From: michael@chpc.utexas.edu (Michael Lemke)
  4. Subject: Re: function name as an argument
  5. Message-ID: <1992Dec15.064208.21277@chpc.utexas.edu>
  6. Organization: The University of Texas System - CHPC
  7. References: <1992Dec14.193634.5231@newshost.lanl.gov> <1gj95eINNqgo@gap.caltech.edu> <1992Dec15.061743.20060@chpc.utexas.edu>
  8. Date: Tue, 15 Dec 92 06:42:08 GMT
  9. Lines: 69
  10.  
  11. In article <1992Dec15.061743.20060@chpc.utexas.edu> michael@chpc.utexas.edu (Michael Lemke) writes:
  12. >In article <1gj95eINNqgo@gap.caltech.edu> shepard@sampson.ccsf.caltech.edu (Ron Shepard) writes:
  13. >>I believe that the following is standard f77.  
  14. >
  15. >    I don't think so -- see below.
  16. >
  17. [...]
  18. >>      program dumb
  19. >>      character*30 cvar
  20. >>      character*(*) cfun
  21. >>      external cfun
  22. [...]
  23.  
  24. >>Upon execution on a couple of machines, I get:
  25. >>
  26. >>cvar=1234567890xxxxxxxxxxxxxxxxxxxx
  27. >>cvar=12345678901234567890xxxxxxxxxx
  28. >>
  29. >>which is what I thought I should get according to the previous discussion
  30. >>in this thread.  
  31. >>
  32. >>Are there any machines that give different results?
  33. >
  34. >    Yes, VAX/VMS:
  35. >
  36. >$ for x
  37. >%FORT-F-ADJLENUSE, Passed length character name used in invalid context 
  38. >     [CFUN] in module DUMB 
  39. >%FORT-F-ENDNOOBJ, IO$DUC0:[MICHAEL]X.FOR;2 completed with 1 diagnostic - object 
  40. >deleted
  41. >
  42. >So what junky Fortran took this?
  43. >
  44.  
  45. I knew the Sun would take it!  Just tried.  That crap can also modify a 
  46. parameter like so:
  47.  
  48.     Program dumber
  49.     parameter( j = 77 )
  50.  
  51.     call foo( j )
  52.  
  53.     type *, j
  54.     end
  55.  
  56.     subroutine foo( j )
  57.  
  58.     type *, 'foo> ', j
  59.  
  60.     j = 99
  61.  
  62.     type *, 'foo> ', j
  63.  
  64.     end
  65.  
  66. Prints something like:
  67.  
  68. foo> 77
  69. foo> 99
  70. 77
  71.  
  72. At least J doesn't get changed in the main program.  I think this should
  73. crash at the assignment to J in FOO.  What say the Fortran lawyers here?
  74.  
  75. Michael
  76. -- 
  77. Michael Lemke
  78. Astronomy, UT Austin, Texas
  79. (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
  80.