This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: Fix idiocy in previous patch
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Alexandre Oliva'" <aoliva at redhat dot com>,"'Nick Clifton'" <nickc at redhat dot com>
- Cc: "'Eric Botcazou'" <ebotcazou at adacore dot com>,"'Ben Elliston'" <bje at au dot ibm dot com>,<binutils at sources dot redhat dot com>
- Date: Tue, 28 Jun 2005 18:16:02 +0100
- Subject: RE: Fix idiocy in previous patch
----Original Message----
>From: Alexandre Oliva
>Sent: 27 June 2005 19:30
> On Jun 8, 2005, Nick Clifton <nickc@redhat.com> wrote:
>> switch (foo)
>> {
>> case 0: prefix="hi";
>> case 1: prefix="bye";
>> case 2: prefix="ciao";
>> strcpy (buffer, "%s Nick", prefix);
>> break;
>> }
>
> You can do that in C. Just make the cases the `then' part of if(0)s:
>
> 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"?
> Yuck :-)
It's sick, but I like it!
cheers,
DaveK
--
Can't think of a witty .sigline today....