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

  1. Path: sparky!uunet!sun-barr!ames!agate!darkstar.UCSC.EDU!fast!sla
  2. From: sla@fast.ucsc.edu (Steve Allen)
  3. Newsgroups: comp.lang.fortran
  4. Subject: summary (was Fortran 90:  Pointers to Functions?)
  5. Date: 18 Aug 1992 06:46:05 GMT
  6. Organization: UCO/Lick Observatory
  7. Lines: 31
  8. Message-ID: <16q6bdINNpqh@darkstar.UCSC.EDU>
  9. NNTP-Posting-Host: fast.ucsc.edu
  10. Summary: like I said
  11.  
  12. This is the final summary of all gleaned wisdom on the topic of
  13. Pointers to Functions in Fortran 90.
  14.  
  15. Fortran 90 does not have anything which matches the concept of pointers
  16. to functions as in the C language.  It does have the ability to pass
  17. single functions into another function using the EXTERNAL declaration;
  18. this is the same as in the Fortran 77 syntax.
  19.  
  20. This means that it is not possible to have "arrays of functions" or
  21. "structures containing an element which is a function" as in C.
  22.  
  23. It is also not clear just what the meaning of a "pointer to a function"
  24. would be on some kinds of multi-processor systems.
  25.  
  26. klassen@sol.UVic.CA (Melvin Klassen) points out that with some Fortran 77s it
  27. is possible to fake this functionality by making use of argument mismatch.
  28. This might be accomplished by passing a function into some other routine
  29. using EXTERNAL and withing the receiving routine declaring that dummy
  30. argument to be an INTEGER which stores the received value.  With some
  31. Fortran compilers this may require a non-Fortran intermediary because
  32. the EXTERNAL may be passed "by value" rather than "by reference".
  33.  
  34. It is not clear whether this kind of cheating will actually work with
  35. the new "vector-valued functions" of Fortran 90.
  36.  
  37. Overall this subject has provoked remarkably little response, and I'm
  38. gonna shut up and keep working on the (Fortran 77) code for my thesis.
  39. _______________________________________________________________________________
  40. Steve Allen          | That was the equation!         |   sla@helios.ucsc.edu
  41. UCO/Lick Observatory | Existence!...Survival must     | If the UC were opining,
  42. Santa Cruz, CA 95064 | cancel out programming! -- Ruk | it wouldn't tell me.
  43.