home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!cwi.nl!dik
- From: dik@cwi.nl (Dik T. Winter)
- Newsgroups: comp.lang.fortran
- Subject: Re: Jumping from nested subroutine to main directly?
- Message-ID: <7975@charon.cwi.nl>
- Date: 23 Nov 92 23:54:34 GMT
- References: <1992Nov21.015026.17820@netcom.com>
- Sender: news@cwi.nl
- Organization: CWI, Amsterdam
- Lines: 26
-
- In article <1992Nov21.015026.17820@netcom.com> jchauvin@netcom.com (John H. Chauvin) writes:
- > Is it possible to transfer control from a nested subroutine directly to the
- > main routine without have to execute multiple returns from all the
- > subroutines in between? I would like a way of exiting directly to the main
- > routine when a error is detected six or seven subroutines down.
- >
- There is a highly non-portable way that works on some systems:
- SUBROUTINE A()
- COMMON /JMPBCK/ ILAB
- ASSIGN 10 TO ILAB
- CALL B()
- 10 CONTINUE
- RETURN
- END
- ...
- SUBROUTINE Z()
- COMMON /JMPBCK/ ILAB
- GOTO ILAB
- END
- but with systems that use a stack for Fortran programs (as most current
- systems do) this will fail.
-
- Should I add a smiley?
- --
- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland
- home: bovenover 215, 1025 jn amsterdam, nederland; e-mail: dik@cwi.nl
-