I saw someone’s C++ code has function declaration like below:
void information_log( const char* fmt , ...)
or catch block like
catch(...)
{
}
What does “…” mean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The ellipsis
..., in a function prototype, is used to denote the function as variadic. That is, it enables a variable number of arguments to be passed into the function. In this form, a function must define some way for the user to specify exactly how many arguments they presented, since the variadic library functions in C++ can’t determine this information dynamically.For example, the stdio function
printfis one such function with the prototype:Presumably, from the similarities between the two prototypes, the
information_logfunction you describe is designed to mirror much ofprintf‘s functionality and perhaps even internally usesprintf, or one of its cousins.The following is an example of how to implement a variadic function: