I am trying to write a doxygen block comment for a function with unlimited number of parameters, then I couldn't find a right tag for it. Supplied parameters should all be strings, and they will be concatenated in the function to form a new string.
What is the right use of doxygen tags?
The variadic function consists of at least one fixed variable and then an ellipsis(…) as the last parameter. This enables access to variadic function arguments. *argN* is the last fixed argument in the variadic function. This one accesses the next variadic function argument.
Variadic functions are functions (e.g. std::printf) which take a variable number of arguments. To declare a variadic function, an ellipsis appears after the list of parameters, e.g. int printf(const char* format...);, which may be preceded by an optional comma.
Variable number of arguments in C++Define a function with its last parameter as ellipses and the one just before the ellipses is always an int which will represent the number of arguments. Create a va_list type variable in the function definition. This type is defined in stdarg. h header file.
A pattern I see frequently in phpdoc (the format of which doxygen understands) is:
/**
* Shortdesc.
* Longdesc. Longdesc. Longdesc. Longdesc.
* @param mixed $something Description
* @param mixed ... Description
*/
function foo() { ... }
Yes, literally ...
as the variable name.
Actually, the syntax on the phpDocumentor is $paramname,...
/**
* Builds a file path with the appropriate directory separator.
* @param string $segments,... unlimited number of path segments
* @return string Path
*/
function file_build_path(...$segments) {
return join(DIRECTORY_SEPARATOR, $segments);
}
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