[linux-elitists] Goto vs. named scopes
Nick 'Sharkey' Moore
Sat Jan 11 16:42:06 PST 2003
On Sat, Jan 11, 2003 at 01:24:12PM -0500, Michael Bacarella wrote:
> [Jim Bray wrote:]
> > Allow all scopes to be named, and allow break and continue to operate
> > with those names. Add to those a 'restart' operation and you're pretty
> > much all set.
> The other common use is in cleanup routines.
> Not the most streamlined example but I think it illustrates
> my point. Maybe I haven't thought about it enough, but could
> your extensions make that better?
Well, assuming that if 'break <label>' jumps to the end of
the block labelled <label>, 'break' will jump to the end of the
int stoopid(int foo)
r = open_resource();
if (!r) break;
if (something_didnt_work(r)) break;
if (something_else_didn't_work(r)) break;
if (resource_mysteriously_went_away_already(r)) break outer;
if (goddamn_it(r)) break;
Something like that, anyway. Most of the time the 'goto release_lock_out'
construction is used it's just away of avoiding incredible levels of
More information about the linux-elitists