Re: [Infiniband-general] Getting an Infiniband access layer intheLinux kernel
From: Richard B. Johnson
Date: Fri Feb 06 2004 - 13:54:23 EST
On Fri, 6 Feb 2004 Valdis.Kletnieks@xxxxxx wrote:
> On Fri, 06 Feb 2004 13:00:38 EST, "Richard B. Johnson" said:
>
> > Yes you can. You just don't use an ';' if you are going
> > to use 'else'.
>
> You did realize we've changed things from macros to inline functions
> (and vice versa) on occasion?
>
> Yes, you *can* hack around the "problem". Is there any actual
> evidence that any real performance issues arise from the null
> do/while? Does said issue outweigh the increased fragility of
> the code?
>
Well the 'problem' is a demonstration. The last time I answered
a query about the "do {} while(0)", stuff (as an advocate), there
were tons of 'experts' that jumped on me for helping to propagate
this "atrocious" (as I recall) abuse of the 'C' language. I
was severely tongue-lashed into believing that there was no
actual reason for doing it that way.
Now, after I have been properly "trained" that "do {} while (0)" is
an abuse, we get the other 'experts' who say I'm wrong again!
Can't win.
In spite of the fact that the gcc compiler I'm using doesn't
care, and generates the same code either way, there are others
in the world who have looked at Linux code, in particular
the headers, and turned various shades of grey just before
running off to the head. I have spent a bunch of time looking
at C/C++ headers for Sun and W$ and the only place I've
ever seen the "do {} while(0)" stuff is in Linux. I think
it started with Linux (was a Linux Invention!), as some
kind of work-around, then it became a "Linux Signature".
Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i986 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/