This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Fix idiocy in previous patch
- From: Thorsten Glaser <tg at 66h dot 42h dot de>
- To: binutils at sources dot redhat dot com
- Date: Sun, 17 Jul 2005 14:20:36 +0000
- Subject: Re: Fix idiocy in previous patch
- References: <200506080002.j5802x9K025093@sethra.codesourcery.com><d8612s$bdi$1@sea.gmane.org> <200506080932.24188.ebotcazou@adacore.com><42A6C509.9050900@redhat.com> <or8y0vd54u.fsf@livre.redhat.lsd.ic.unicamp.br>
Alexandre Oliva dixit:
>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 :-)
evilwm does it like this.
>From event.c:
if (c) {
switch (key) {
/* Sorry about all these if (0)s, but they actually
* *do* do something useful... */
[...]
break;
case KEY_SLEFT:
c->width -= c->width_inc; if (0)
case KEY_SDOWN:
c->height += c->height_inc; if (0)
case KEY_SUP:
c->height -= c->height_inc; if (0)
case KEY_SRIGHT:
c->width += c->width_inc;
if (c->width < 1)
c->width = 1;
if (c->height < 1)
c->height = 1;
moveresize(c);
break;
[...]
//mirabile
--
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence. -- Coywolf Qi Hunt