Path: utzoo!utgpu!water!watmath!clyde!att!att-ih!pacbell!ames!umd5!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uiucdcsm!wsmith From: wsmith@uiucdcsm.cs.uiuc.edu Newsgroups: comp.lang.c Subject: Re: Put your code... (was Re: gotos Message-ID: <4700011@uiucdcsm> Date: 28 Apr 88 00:30:00 GMT References: <422@yunexus.UUCP> Lines: 32 Nf-ID: #R:yunexus.UUCP:422:uiucdcsm:4700011:000:820 Nf-From: uiucdcsm.cs.uiuc.edu!wsmith Apr 27 19:30:00 1988 > However the most > common instance is of the form > > procedure () { > prolog code > main body > epilog: epilog code > } > > The gotos live in the main body at various levels of nesting and all > transfer to the epilog code which typicaly does things like returning > space to the allocator. This is an alternative technique that may avoid the goto: procedure () { prolog code do { main body } while (0); epilog code } A break or continue inside the 1 time only do-while will jump to the epilog code. I think this is only an academic curiosity, and I haven't ever seen code actually using this construct. Has anyone actually written code with this in it? The optimizer should generate the same code as if goto's were used directly. Bill Smith wsmith@a.cs.uiuc.edu ihnp4!uiucdcs!wsmith