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


----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....


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