开发者

Reference static const variables declared in namespace

I am fleshing out the doxygen documentation for my modules and came across a strange problem. When referencing variables located in a namespace autolinking does not work. Here is a snippet:

namespace isa {

const double H_max= 10000; //!< @brief Maximum altitude in meters.

//! @brief Calculate air densitity at altitude \a H.
//! @throw argument_exception when \a H exceeds ::H_max.
double rho(double H);

} // namespace isa

I would expect doxygen to put a link to H_max at the exception description of function rho(double) to direct开发者_如何学Go the reader to the constant. But it only does if I leave away the namespace, otherwise autolinking does not work.

What am I doing wrong?

Thanks in advance.


OK, so the problem here is not a doxygen wrong behavior, but a misunderstanding on how the global namespace prefix :: works.

::H_max identifies a symbol defined in the global namespace, that is, out of any namespace. I'm afraid - correct me if I'm wrong - that you where expecting it to behave as the parent directory .. identifier.

When doxygen processes the code snippet you provided, it doesn't link ::H_max in the exception description because it cannot find a H_max variable in the global namespace. If you remove the double colon prefix, it should provide a link to isa::H_max.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜