I wonder if its okay to comment methods in c in the same way you comment code in java-language?
/**
*
* @param x
* @param y
* @return
*/
protected boolean myMethod(int x, int y) {
return true;
}
that is in the same manner in c
/**
*
* @param x
* @param y
* @return
*/
int myMethod(int x, int y) {
return 1;
}
Of course its up to the programmer but I would like to know if c-programmers uses these @param or not?
In C/C++ there are two types of comments : Single line comment. Multi-line comment.
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. Comments can be singled-lined or multi-lined.
Place the comment on a separate line, not at the end of a line of code. Begin comment text with an uppercase letter. End comment text with a period. Insert one space between the comment delimiter (//) and the comment text, as shown in the following example.
A comment starts with a slash asterisk /* and ends with a asterisk slash */ and can be anywhere in your program. Comments can span several lines within your C program. Comments are typically added directly above the related C source code.
Of course its up to the programmer but I would like to know if c-programmers uses these @param or not?
In C, whatever you put inside the /**/
is treated as comments. But I dont think @param
has got anything to do for it in C.
As far as @
is concerned the @
in Java is for the Javadoc functionality.
Doc-comments like these are not commonly used in C. They may be useful in some IDEs to generate documentation for functions, but I don't recall ever seeing these comments in C source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With