svn commit: r209119 - head/sys/sys

mdf at FreeBSD.org mdf at FreeBSD.org
Mon Jun 14 13:50:12 UTC 2010


> BTW, one reason I liked BSD code more than gnu code is that it didn't
> use so many macros.  Macros should only exist when they are not just
> syntactic sugar, like DPCPU_SUM() and unlike CPU_FOREACH().

As a style question, I do understand (generally) why too many macros
make the code confusing.  However, the *FOREACH macros all fit the
same pattern and having a macro to iterate protects one against
changes in the implementation -- there's a single location to change
if e.g. we want to make CPU_FOREACH use a bitwise operator to
determine the next non-zero bit, rather than testing each
individually.

So what I'm asking is, how do we balance the simplicity of the code
(no "unnecessary" macros) versus the simplicity of making certain
kinds of infrastructure changes simpler?

Thanks,
matthew


More information about the svn-src-head mailing list