home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!convex!constellation!iapa!ctrbdo
- From: ctrbdo@iapa.uucp%mailhost.ecn.uoknor.edu (bryan d oakley)
- Subject: ENTRY in main (was re: Jumping from nested subroutine to main directly)
- Message-ID: <By4xpo.FG@iapa.uucp%mailhost.ecn.uoknor.edu>
- Organization: FAA / Mike Monroney Aeronautical Center
- Date: Sun, 22 Nov 1992 20:46:34 GMT
- Lines: 44
-
- >== 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. However, I
- > suspect he wants something a bit more `automatic' than that, but I
- > don't think it exists in FORTRAN. Does it exist in C, Pascal, ..?
-
- 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? I'm guessing
- the code would look like this (pardon the GOTOs :-):
-
- program example
-
- c top of main loop:
- 10 <get input...>
- <process input ...>
- <produce output ...>
- if (.not. done) goto 10
- goto 20
- c end of main loop...
-
- ENTRY error
- <process error condition>
- if (.not. fatal) goto 10
- goto 20
-
- 20 end
-
-
- Does anybody do this in the real world?
-
- --
- ----------------------------------------------------------------------
- Instrument Approach Procedures Automation DOT/FAA/AMI-230
- ----------------------------------------------------------------------
- Bryan D. Oakley ctrbdo%iapa@mailhost.ecn.uoknor.edu
-