tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: KNF and the C preprocessor



On Mon, Dec 10, 2012 at 09:36:35AM -0600, David Young wrote:
 > What do people think about setting stricter guidelines for using the
 > C preprocessor than the guidelines from the past?

I don't see the point; also, if your intent is to declare war on the
kernel config system we have, it'd be better to tackle it directly
rather than trying to get it ruled illegal via the back door.


(Also, as a side issue, at least one of your examples is invalid.

 > 1 Lazy evaluation: unlike a function call's arguments, a macro's
 >   arguments are not evaluated before the macro is "called."  E.g., in
 >   the code below, the second and following arguments of M(a, b, c, d, e)
 >   are not evaluated unless p(a) is true:
 > 
 >      #define M(__x, ...)                     \
 >      do {                                    \
 >              if (p(__x))                     \
 >                      f(__x, __VA_ARGS__);    \
 >      } while (false)
 > 
 >      M(a, b, c, d, e);

The C standard makes no such guarantee.)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index