[英]With doxygen, when should the comments be placed before the entity, and when after?
這里有兩個 styles 對實體的評論(例如,在類似 C/C++ 的語言中)。
款式一:
// This is a comment
// about foo
int foo;
// This is a comment
// about bar
int bar;
樣式 2:
int foo;
// This is a comment
// about foo
int bar;
// This is a comment
// about bar
我知道,通常,在編寫 doxygen 注釋時,它通常出現在記錄的實體之前,例如:
/// This is a doxygen comment
/// about foo
int foo;
/// This is a doxygen comment
/// about bar
int bar;
情況總是如此,還是我可以將它放在實體之后,就像上面的第二種評論風格一樣?
是的,您可以將您的 doxygen 評論放在被評論的項目之后,但在那種情況下,您必須在評論中添加一個特殊標記。 這在Doxygen 文檔中有解釋:
將文檔放在成員之后
如果要記錄文件、結構、聯合、class 或枚舉的成員,有時需要將文檔塊放在成員之后而不是之前。 為此,您必須在注釋塊中添加一個額外的
<
標記。 請注意,這也適用於 function 的參數。這里有些例子:
int var; /*!< Detailed description after the member */
此塊可用於在成員后放置 Qt 樣式的詳細文檔塊。 其他做同樣事情的方法是:...
int var; ///< Detailed description after the member ///<
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.