Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

Jeremy Fitzhardinge
2007-06-04T19:01:29Z

H. Peter Anvin wrote:
> goto labels are scoped in one sense: they are only reachable from inside
> the block they are defined in, so I would disagree with this statement.
>

Erm, no I think you're wrong there (or we're talking at cross
purposes). They're visible to the whole function they're defined in,
regardless of what block scope happens to be current at the time. You
need to use the gcc "__label__" extension to make a locally-scoped
label. Otherwise this wouldn't work:

if (a_failed)
goto cleanup;
[...]
if (b_failed) {
cleanup:
cleanup();
}

J