问题
I am documenting a codebase using Doxygen and was wondering if there is a keyword for declaring an argument to a function to be optional. Something like:
/*!
\fn int add(int a, int b=0)
\brief adds two values
\param a the first operand
\param \optional b the second operand. Default is 0
\return the result
*/
It seems like this is something that should exist, but I haven't been able to find it anywhere. Is there an actual option, or do I just need to make note in the description?
回答1:
To answer your question: No, there is no such thing.
But I don't share your opinion that there should be something like that. After all, the function declaration will be displayed together with its documentation, so everybody can see that b
is optional and what it's default argument is. And for the \fn
see doxygen's documentation discouraging the use of \fn.
回答2:
What you want is not provided by Doxygen - you will have to manually make a note of it in the description.
来源:https://stackoverflow.com/questions/14261136/doxygen-declare-parameter-as-optional