Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

funny looking comments - c++

Tags:

c++

c

visual-c++

when i read through source files of opensource projects i often come across some weird phrases in the comments

/*       
@brief ......  
@usage.....  
@remarks....  
@par....  
*/

questions
1.What are they?(were not mentioned when i was learning c++)
2.Do they have any documentation(where)

like image 963
Dr Deo Avatar asked Mar 27 '10 18:03

Dr Deo


People also ask

How do you write a good comment in C?

There are two ways to add comments in C: // - Single Line Comment. /*... */ - Multi-line Comment.

Why do we comment in C?

Comments in C Comments can be used to explain code, and to make it more readable. It can also be used to prevent execution when testing alternative code.

How do you write comment lines?

The single line comment is //. Everything from the // to the end of the line is a comment. To mark an entire region as a comment, use /* to start the comment and */ to end the comment. * This is a block comment.


2 Answers

They are just comments and as such have no special meaning in C++. They are probably to allow a documentation generator (For example Doxygen) to extract the data from the comments.

like image 198
Yacoby Avatar answered Oct 07 '22 08:10

Yacoby


Those are for some flavour of automatic documentation generator. Another program runs through the code looking for comments of like you see there. The @... keywords identify how the documentation should be laid out, and that program generates pretty HTML or printed documentation directly from the source code. It's a way to keep the docs up-to-date with the code more easily.

like image 45
Carl Norum Avatar answered Oct 07 '22 07:10

Carl Norum