Reputation: 487
I am adding comments to a c++ program. Let's say we have something like this:
string House:: getName(int &size){
return name;
}
In Java when you write comments above next to asterisks you name them like this:
/*
* @param size It passes the number of rooms.
@return name. It returns name of the house
*/
What is the format of doing this in c++?
Upvotes: 0
Views: 275
Reputation: 6265
If you are using Visual Studio, here is the spec for comment documentation.
Upvotes: 1
Reputation: 1503
If you are extracting documantation from the code, then you need to follow the appropriate comment format. For example, we use DOxygen, so we have to follow the Doxygen rules.
If you aren't going to extract comments for documentation, then simple good coding practices apply.
Upvotes: 3
Reputation: 47493
There are no specific rules. Comments are comments, they are ignored and thrown away, so you can shape them in any way you like.
If you want to use a program that interprets the comments, doxygen for example, then you have to look at the reference of that program.
Upvotes: 2
Reputation: 93690
You are referring to Javadoc and you can use that same style of comments in C++ with the same editors and external tools.
There's no C++ "standard" for comment documents.
Upvotes: 6