NO

Author Topic: v7.00 __VA_ARGS__ handling  (Read 2834 times)

paulpp

  • Guest
v7.00 __VA_ARGS__ handling
« on: September 11, 2012, 05:24:28 PM »
Test source:

Code: [Select]
#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):

Quote
int 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:

Quote
int main(int argc, char *argv[])
{
        int a,b,c;
        a;
        b,c;
        a;
        ;
    return 0;
}
« Last Edit: September 11, 2012, 08:09:52 PM by Stefan Pendl »

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: v7.00 __VA_ARGS__ handling
« Reply #1 on: September 22, 2012, 04:07:00 PM »
__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