switch question in recog.c
Zack Weinberg
zack@codesourcery.com
Tue Oct 7 22:34:00 GMT 2003
Michael Matz <matz@suse.de> writes:
> Hi,
>
> On 7 Oct 2003, Andrew MacLeod wrote:
>
>> Huh. I would have failed that question miserably after using the
>> language for 20 years.
>
> Then you never used a variant of the holy, mighty device from Tom Duff ;-)
>
> Constructed useless example (i.e. not the usual memcpy() unrolling):
"For maximum obfuscation, the outer braces can be removed":
extern void abort ();
int f(int i)
{
switch (i & 1)
while (1)
if (i > 32) {
abort ();
case 0: return 1;
} else {
abort ();
case 1: return 2;
}
}
> "case x" is a normal label (with the exception that it's scoped to
> the enclosing case statement) introducing a labeled statement, hence
> it can be placed everywhere as long as it's inside a switch.
Except you can't goto a case label. Occasionally I want to be able to
write "goto default;".
zw
More information about the Gcc
mailing list