lua-users home
lua-l archive

Re: What's the purpose of these parentheses in the #define's?

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


On 26/01/2015 10:00, Philipp Janda wrote:
Am 26.01.2015 um 08:51 schröbte William Ahern:
The macro arguments might themselves be comma expressions. So the
parentheses aren't useless.
You can't have comma expressions without parentheses in argument lists.
 #define X(a, b) ...
 X(1, 2); /* ok */
 X(1, 2, 3); /* constraint violation: wrong number of arguments */
 X((1, 2), 3); /* ok, using comma expression as first argument */
What about vararg functions? (My C is rusty, so it can be an invalid remark!)
Of course, this discussion is mostly theoretical, I would say as above the parentheses are here mostly for consistency (with other macros) and common practice.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --

AltStyle によって変換されたページ (->オリジナル) /