home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4418 < prev    next >
Encoding:
Internet Message Format  |  1992-11-23  |  2.0 KB

  1. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!sun-barr!west.West.Sun.COM!male.EBay.Sun.COM!exodus.Eng.Sun.COM!lupa.Eng.Sun.COM!corbett
  2. From: corbett@lupa.Eng.Sun.COM (Robert Corbett)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: ENTRY in main (was re: Jumping from nested subroutine to main directly)
  5. Date: 23 Nov 1992 05:41:13 GMT
  6. Organization: Sun Microsystems, Mt. View, Ca.
  7. Lines: 43
  8. Message-ID: <lh0rnpINN5ul@exodus.Eng.Sun.COM>
  9. References: <By4xpo.FG@iapa.uucp%mailhost.ecn.uoknor.edu>
  10. NNTP-Posting-Host: lupa
  11.  
  12. In article <By4xpo.FG@iapa.uucp%mailhost.ecn.uoknor.edu> ctrbdo@iapa.uucp%mailhost.ecn.uoknor.edu (bryan d oakley) writes:
  13. >>== Michael Page writes:
  14. >> One way to almost do what he wants is to use an ENTRY statement at
  15. >> the point he wants to return to in the main program.
  16. >
  17. >Hmmm... I've been programming FORTRAN for 10ish years (if you count
  18. >college) and NEVER thought to put an ENTRY in the main program,
  19. >though at first glance it seems to be the only time I might consider
  20. >using an ENTRY point (yes, I'm one of the people that frowns :-( on
  21. >the use of ENTRY points).
  22. >
  23. >Question: what does this do to the stack?  If you kept jumping back to
  24. >the main routine everytime you had an error, and never 'returned' from
  25. >the routine causing the error, wouldn't the stack just grow un-
  26. >controllably?  Also, wouldn't this be considered recursion, since a
  27. >routine subordinate to main (effectively) calls main?
  28.  
  29. Interestingly, the FORTRAN standard does not contain language
  30. prohibiting the main program from being called recursively.
  31. Since it does not permit calling the main program at all from
  32. within a running program, perhaps such a restriction was felt
  33. to be superfluous.
  34.  
  35. In any case, a main program cannot contain an ENTRY statement.
  36. Section 14.2 of X3.9-1978 states
  37.  
  38.     A main program may contain any other statement except a
  39.     BLOCK DATA, FUNCTION, SUBROUTINE, ENTRY, or RETURN
  40.     statement.
  41.  
  42.  
  43.                     Yours truly,
  44.                     Robert Corbett
  45. *
  46. *
  47. *
  48. *
  49. *
  50. *
  51. *
  52. *
  53. *
  54. *
  55.