I was looking into some C++ source code files which perform some parsing when I came across
a rather curious looking function as shown below along with the Doxygen documentation.
My question is, in the arguments of the function ERROR what do the trailing dots (…)
mean? This is the first time I am seeing this being used.
/**
* Create an error with given message id and fill in given string in message
* @PARAM row row where the error occured (0 to neglect)
* @PARAM col column where the error occured (0 to neglect)
* @PARAM id id of the message
* @PARAM arg an argument which will be filled in in the message,
* replacing %s, %i, %f, %c
*/
Error::Error(const int row, const int col, const int id, ...)
: err_row(row), err_col(col), err_id(id)
{
//sprintf(msg, msgdesc(id));
const char* msg_desc = msgdesc(id);
va_list args;
va_start(args, msg_desc);
vsnprintf(msg, sizeof(msg)-1, msg_desc, args);
msg[sizeof(msg)-1] = '\0';
va_end(args);
}
The gcc compiler which I use throws me the following warning (among others concerning other files)
parser_error.cpp: In constructor ‘Error::Error(int, int, int, ...)’:
parser_error.cpp:30: warning: second parameter of ‘va_start’ not last named argument
That is a variable length argument list. From man
stdarg: