News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

v7.00 __VA_ARGS__ handling

Started by paulpp, September 11, 2012, 05:24:28 PM

Previous topic - Next topic

paulpp

Test source:

#define va_head(h, ...) h
#define va_tail(h, ...) __VA_ARGS__
int main(int argc, char *argv[])
{
int a,b,c;
va_head(a,b,c);
va_tail(a,b,c);
va_head(a);
va_tail(a);
    return 0;
}


Otput from Pelles C (option -E):

Quoteint main(int argc, char *argv[])
{
   int a,b,c;
   a;
   b,c;
   va_head(a);
   va_tail(a);
    return 0;
}

Output from MSVC and GCC:

Quoteint main(int argc, char *argv[])
{
        int a,b,c;
        a;
        b,c;
        a;
        ;
    return 0;
}

Pelle

__VA_ARGS__ and ... was introduced in C99, and you must provide at least one argument for the "..." case (it can't be empty). I see no bug here.

( MSVC is C89/C90, so it's totally irreleveant. My copy of GCC produces two warnings for your code, and POCC 7.0 produces two errors. )
/Pelle