After having some readings about Doxygen I’m a bit confused where to document my variable, function etc. Should it be in the implementation file(source) or in its interface(header file).
What is the best practise regarding that.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Place documentation in your headers. And one very important thing to look out for is to not overdocument. Don’t start writing a comment for every single variable and function, especially if all you do is state the obvious. Examples…
This comment below is obvious and unhelpful. All the comment says is perfectly clear just by looking at the function.
You should instead document how the function behaves in extreme situations. For example, what does it do if the parameters are wrong? If it returns a pointer, whose responsibility is it to delete the pointer? What other things should programmers keep in mind when using this function? etc.
Also, I would advice you only document the interface in the header files: don’t talk about how the function does something, tell only what it does. If you want to explain the actual implementation, I’d put some relevant (normal) comments in the source file.