Using Doxygen with C, do you comment the function prototype or the definition? Or both?

前端 未结 5 828
余生分开走
余生分开走 2020-12-28 14:18

I\'m using Doxygen with some embedded C source. Given a .c/.h file pair, do you put Doxygen comments on the function prototype (.h file) or the function definition (.c file)

5条回答
  •  情歌与酒
    2020-12-28 15:03

    Quoted from my answer to this question: C/C++ Header file documentation:

    I put documentation for the interface (parameters, return value, what the function does) in the interface file (.h), and the documentation for the implementation (how the function does) in the implementation file (.c, .cpp, .m). I write an overview of the class just before its declaration, so the reader has immediate basic information.

    With Doxygen, this means that documentation describing overview, parameters and return values (\brief, \param, \return) are used for documenting function prototype and inline documentation (\details) is used for documenting function body (you can also refer to my answer to that question: How to be able to extract comments from inside a function in doxygen?)

提交回复
热议问题