Put your code... (was Re: gotos
wsmith at uiucdcsm.cs.uiuc.edu
wsmith at uiucdcsm.cs.uiuc.edu
Thu Apr 28 10:30:00 AEST 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 at a.cs.uiuc.edu ihnp4!uiucdcs!wsmith
More information about the Comp.lang.c
mailing list