I use the ROOT C++ libraries (root.cern.ch) daily and was browsing the source when I came across this function declaration:
TString TString::Format(const char *va_(fmt), ...)
{
//etc.
It can be found here.
I don't understand how a const char *
can have an argument or a parenthesis in its name.
The expression va_(fmt)
is later used as a simple const char *
even though it looks like a function call or a constructor. At first I thought it had something to do with the variable argument list, which was also new to me, but reading documentation on stdarg.h didn't help with this question at all.
It is very hard to google for help since I'm not really sure what to call this. A declaration with an argument? That doesn't give any good results.
I used to think I knew C++, but what is going on here? All help will be appreciated.
It's a macro - in Varargs.h
:
#if ...
# define va_(arg) __builtin_va_alist
#else
# define va_(arg) arg
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With