This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Fix idiocy in previous patch
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: "Dave Korn" <dave dot korn at artimi dot com>
- Cc: "'Nick Clifton'" <nickc at redhat dot com>, "'Eric Botcazou'" <ebotcazou at adacore dot com>, "'Ben Elliston'" <bje at au dot ibm dot com>, <binutils at sources dot redhat dot com>
- Date: 01 Jul 2005 10:38:22 -0300
- Subject: Re: Fix idiocy in previous patch
- References: <SERRANOd0EGgNwWi2F200000271@SERRANO.CAM.ARTIMI.COM>
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}