Please help me understand this C ++ parameter declaration with argument

I use the ROOT C ++ libraries (root.cern.ch) daily and looked at the source code when I came across this function declaration:

TString TString::Format(const char *va_(fmt), ...) { //etc. 

You can find it here.

I do not understand how const char * can have an argument or brackets in its name. The va_(fmt) expression is later used as a simple const char * , although it looks like a function call or constructor. At first I thought that this was due to a variable list of arguments, which was also new to me, but reading the documentation for stdarg.h did not help at all in this matter.

It’s very difficult for Google to help, as I’m not quite sure what to call it. Declaration with an argument? This does not give good results.

I used to think I know C ++, but what happens here? All help would be appreciated.

+6
source share
1 answer

This macro is in Varargs.h :

 #if ... # define va_(arg) __builtin_va_alist #else # define va_(arg) arg #endif 
+11
source

Source: https://habr.com/ru/post/911206/


All Articles