记录与Doxygen的变量用C [英] Documenting variables with Doxygen in C

查看:151
本文介绍了记录与Doxygen的变量用C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

code:

#include <stdio.h>

/*
 * \var int iOne
 * \brief Integer 1
 */
/*
 * \var int iTwo
 * \brief Integer 2
 */
/*
 * \var int iThree
 * \brief Integer 3
 */

/**
 * \brief Imitates a sheep.
 */
void sheep();

/**
 * \brief Main function for test code
 */
int main() {
    int iOne, iTwo, iThree;
    iOne = 1;
    iTwo = 2;
    iThree = 3;
    printf("%d %d %d", iOne, iTwo, iThree);

    return 0;
}

void sheep() {
    printf("Meeeh");
}

这不会为<$​​ C $ C>卓智说明, ITwo的 iThree 虽然那是我的本意。我该如何解决这个问题?

This doesn't generate descriptions for iOne, iTwo and iThree although that was my intention. How do I fix this?

推荐答案

您需要打开您的意见与 / **

You need to open your comments as Doxygen comments with /**.

有可能是更清楚做到这一点,虽然:

It may be clearer to do this, though:

int main() {
   /** \brief Integer 1 */
   int iOne;
   /** \brief Integer 2 */
   int iTwo;
   /** \brief Integer 3 */
   int iThree;
   /** ... and so on ... */
}

这种方式可以改变变量的名称而不破坏你的文件,它是对谁需要阅读源$ C ​​$ C,因为变量的描述毗邻它,而不是其他的地方其他程序员也更容易该文件。

This way you can change the name of the variable without breaking your documentation and it's also easier on other programmers who need to read your source code because the description of the variable is located next to it, not somewhere else in the file.

这篇关于记录与Doxygen的变量用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆