tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: KNF and the C preprocessor
On Dec 10, 2012, at 12:50 PM, David Holland wrote:
> On Mon, Dec 10, 2012 at 09:36:35AM -0600, David Young wrote:
> ...
> (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.)
Really? if (false) foo (bar()); might evaluate bar() ? Where does it say that?
paul
Home |
Main Index |
Thread Index |
Old Index