Fix idiocy in previous patch
Alexandre Oliva
aoliva@redhat.com
Fri Jul 1 13:38:00 GMT 2005
On Jun 28, 2005, "Dave Korn" <dave.korn@artimi.com> wrote:
>> switch (foo) { case 0: prefix="hi"; if (0) { case 1: prefix="bye";
>> } if (0) { case 2: prefix="ciao"; } strcpy (buffer, "%s Nick",
>> prefix); break; }
>> then hope nobody ever has to look at this piece of code again :-)
> Yow! I've wanted a trick like that soooo many times down the years! Did
> you read that somewhere, or do we have to name it "Oliva's device"?
Frankly, I don't remember. If I saw it, it was a *very* long time
ago, but it's perfectly possible I came up with it myself, although
it was probably not original anyway.
Anyway, instead of this yucky if(0) sequence, I'd probably recommend
the judicious use of gotos, if there isn't some stupid rule that
forbids you from using them while permitting the above :-)
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
More information about the Binutils
mailing list