This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix idiocy in previous patch


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}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]