This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Fix idiocy in previous patch
Hi Guys,
No, you've worked out how switch statements *ought* to work :-)
Definitely. I propose to consider this episode as a compelling argument for
switching Binutils to Ada[*] as soon as possible. ;-)
[*] the "case" statement in Ada does The Right Thing wrt to flow-of-control.
Ah - I remember the glorious days of programming in BBC BASIC. It had a
wonderful switch statement where the code on the same line as the label
would only be executed for the condition that matched the label, but
then unless you had a break statement it would drop through as normal.
This meant that you could have conditional initialisation to a generic
body of code, sort of like this:
switch (foo)
{
case 0: prefix="hi";
case 1: prefix="bye";
case 2: prefix="ciao";
strcpy (buffer, "%s Nick", prefix);
break;
}
Cheers
Nick