Doxygen - declare parameter as optional

风格不统一 提交于 2019-12-10 03:36:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!