本文介绍了Doxygen-声明参数为可选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Doxygen记录代码库,想知道是否有一个关键字来声明函数的参数是可选的.像这样:

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?

推荐答案

要回答您的问题:不,没有这样的东西.

To answer your question: No, there is no such thing.

但我不同意您的看法,即应该有类似的内容.毕竟,函数声明将与其文档一起显示,因此每个人都可以看到b是可选的,它的默认参数是.有关\fn的信息,请参见doxygen的文档禁止使用\ fn .

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.

这篇关于Doxygen-声明参数为可选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 03:55