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

  1. Path: sparky!uunet!mcsun!sun4nl!cwi.nl!dik
  2. From: dik@cwi.nl (Dik T. Winter)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: Jumping from nested subroutine to main directly?
  5. Message-ID: <7975@charon.cwi.nl>
  6. Date: 23 Nov 92 23:54:34 GMT
  7. References: <1992Nov21.015026.17820@netcom.com>
  8. Sender: news@cwi.nl
  9. Organization: CWI, Amsterdam
  10. Lines: 26
  11.  
  12. In article <1992Nov21.015026.17820@netcom.com> jchauvin@netcom.com (John H. Chauvin) writes:
  13.  > Is it possible to transfer control from a nested subroutine directly to the 
  14.  > main routine without have to execute multiple returns from all the 
  15.  > subroutines in between?  I would like a way of exiting directly to the main 
  16.  > routine when a error is detected six or seven subroutines down.
  17.  > 
  18. There is a highly non-portable way that works on some systems:
  19.     SUBROUTINE A()
  20.     COMMON /JMPBCK/ ILAB
  21.     ASSIGN 10 TO ILAB
  22.     CALL B()
  23. 10    CONTINUE
  24.     RETURN
  25.     END
  26. ...
  27.     SUBROUTINE Z()
  28.     COMMON /JMPBCK/ ILAB
  29.     GOTO ILAB
  30.     END
  31. but with systems that use a stack for Fortran programs (as most current
  32. systems do) this will fail.
  33.  
  34. Should I add a smiley?
  35. -- 
  36. dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
  37. home: bovenover 215, 1025 jn  amsterdam, nederland; e-mail: dik@cwi.nl
  38.