NO

Author Topic: Variable numbers of arguments macro  (Read 2447 times)

jiake

  • Guest
Variable numbers of arguments macro
« on: May 05, 2014, 11:32:02 am »
Microsoft Visual C++ support this feature:
Code: [Select]
#define PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__)The following usage are both valid:
Code: [Select]
PRINTF("Good!");
PRINTF("Good (%d)!", 0);
You can pass nothing to the variable numbers of arguments.
I like Pelles C for it supports many new features than Visual C++.
But this one hasn't been supported until 8.0 RC...

iZzz32

  • Guest
Re: Variable numbers of arguments macro
« Reply #1 on: May 05, 2014, 04:37:21 pm »
Code: [Select]
#define PRINTF(...) printf(__VA_ARGS__)

neo313

  • Guest
Re: Variable numbers of arguments macro
« Reply #2 on: May 15, 2014, 02:51:16 pm »
Code: [Select]
#define PRINTF(...) printf(__VA_ARGS__)

And your point is? That still requires an argument.

iZzz32

  • Guest
Re: Variable numbers of arguments macro
« Reply #3 on: May 16, 2014, 06:08:24 am »
Right. And printf requires a format string.

neo313

  • Guest
Re: Variable numbers of arguments macro
« Reply #4 on: May 16, 2014, 11:51:56 am »
Right. And printf requires a format string.

Do you seriously believe that printf is the only function that qualifies for the usage of macro va_args?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1696
Re: Variable numbers of arguments macro
« Reply #5 on: May 16, 2014, 01:54:00 pm »
Try to compile:
Code: [Select]
int __cdecl test(...)
{
return 0;
}

 ;)

neo313

  • Guest
Re: Variable numbers of arguments macro
« Reply #6 on: June 05, 2014, 07:56:42 pm »
I would also like this feature.

Does anyone know a hack that would enable this, or at least similar behavior?