Subject: Re: Proposal: eliminate all macros in the kernel
To: Martin Husemann <>
From: Roland Illig <>
List: tech-kern
Date: 11/20/2005 19:45:30
Martin Husemann wrote:
> On Sun, Nov 20, 2005 at 12:39:10PM -0500, Thor Lancelot Simon wrote:
>>One particular case I was wondering about was the queue.h macros.
> I completely agree with the general idea, and I would suggest to depreciate
> code inside macros, but allow excepetions.
> I realy love CIRCLEQ_FOREACH style macros (and actually wouldn't call that
> "code inside macros"). Same for CALLOUT_INITIALIZER etc.
> See the recent libc/gen/vis.c:MAKEEXTRALIST change for another example
> of bad macro uses.
> It's pretty clear (to me) that this are examples of different classes of
> macro usage, but I'm not sure how to qualify the difference formaly.

I know five different classes:

1. Feature-test macros: HAVE_FOO_H

2. Object-like macros: errno, _IONBF, stdout

3. Function-like macros: isalpha(), offsetof()

4. Syntactic sugar: CIRCLEQ_FOREACH

5. The rest, which are probably few, but very ugly.

In this thread we're only talking about the function-like macros.