Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!gatech!wrdis01!nstn.ns.ca!clyde.concordia.ca!daily-planet.concordia.ca!agostino From: agostino@concour.cs.concordia.ca (Agostino Deligia) Newsgroups: comp.lang.c Subject: Help on use of setjmp(), longjmp() Summary: source example? Keywords: setjmp(), longjmp() Message-ID: <215@daily-planet.concordia.ca> Date: 25 Apr 91 20:21:21 GMT Sender: usenet@daily-planet.concordia.ca Organization: Concordia University, Montreal, Quebec Lines: 47 Hello, Could anyone out there e-mail me an example on how to use setjmp() and longjmp() to return from a low-level function to an upper-level function? For example: void Parse(void) { Init(); DoIt(); fini: /* this is where to jump to before quitting Parse() */ CleanUp(); } ... void P_E(void) { ... P_F(); ... } void P_F(void) { ... if (error) /* jump to 'fini' in Parse() */ ... } I read the man pages for setjmp()/longjmp(), but the code fragment they give doesn't help much. Also, the only book on C that I have doesn't cover setjmp()/longjmp(). Any help would be greatly appreciated. Thank-you. Agostino Deligia -- ------------------------------------------------------------------------------- OO OO Agostino Deligia O O O Systems Architecture O O O Concordia University, Montreal (Canada)