home *** CD-ROM | disk | FTP | other *** search
- 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
- From: corbett@lupa.Eng.Sun.COM (Robert Corbett)
- Newsgroups: comp.lang.fortran
- Subject: Re: ENTRY in main (was re: Jumping from nested subroutine to main directly)
- Date: 23 Nov 1992 05:41:13 GMT
- Organization: Sun Microsystems, Mt. View, Ca.
- Lines: 43
- Message-ID: <lh0rnpINN5ul@exodus.Eng.Sun.COM>
- References: <By4xpo.FG@iapa.uucp%mailhost.ecn.uoknor.edu>
- NNTP-Posting-Host: lupa
-
- In article <By4xpo.FG@iapa.uucp%mailhost.ecn.uoknor.edu> ctrbdo@iapa.uucp%mailhost.ecn.uoknor.edu (bryan d oakley) writes:
- >>== Michael Page writes:
- >> One way to almost do what he wants is to use an ENTRY statement at
- >> the point he wants to return to in the main program.
- >
- >Hmmm... I've been programming FORTRAN for 10ish years (if you count
- >college) and NEVER thought to put an ENTRY in the main program,
- >though at first glance it seems to be the only time I might consider
- >using an ENTRY point (yes, I'm one of the people that frowns :-( on
- >the use of ENTRY points).
- >
- >Question: what does this do to the stack? If you kept jumping back to
- >the main routine everytime you had an error, and never 'returned' from
- >the routine causing the error, wouldn't the stack just grow un-
- >controllably? Also, wouldn't this be considered recursion, since a
- >routine subordinate to main (effectively) calls main?
-
- Interestingly, the FORTRAN standard does not contain language
- prohibiting the main program from being called recursively.
- Since it does not permit calling the main program at all from
- within a running program, perhaps such a restriction was felt
- to be superfluous.
-
- In any case, a main program cannot contain an ENTRY statement.
- Section 14.2 of X3.9-1978 states
-
- A main program may contain any other statement except a
- BLOCK DATA, FUNCTION, SUBROUTINE, ENTRY, or RETURN
- statement.
-
-
- Yours truly,
- Robert Corbett
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
-