lua-users home
lua-l archive

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


Am 26.01.2015 um 08:51 schröbte William Ahern:
On Sun, Jan 25, 2015 at 11:21:45PM -0600, Paige DePol wrote:
Niccolo Medici <niccolomedici@gmail.com> wrote:


Yes, I know about *that*. But the macros I'm talking about look like
function calls. A comma (,) has the lowest precedence in C. So why do
we need the parentheses? Let me modify your example:

We are not talking about the comma operator here but the argument/parameter delimiter for function-like macros, so the precedence of the former is irrelevant anyway.


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 */


Philipp