Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C/C++: What does the comment "/*< */" stand for?

I've got a rather general question: I've recently seen many #defines in C/C++ code that were commented with "/*< ... */", for example:

#define ARRSIZE(x)          (sizeof(x)/sizeof(x[0]))        /*< macro to determine the size of an array */

I personally only saw that in comments for defines and a search in Google didn't answer my question either. Does that have any meaning? Is that just common practice or does it come from Doxygen? Or is it any other reason?

like image 638
drdolphin Avatar asked Sep 11 '20 05:09

drdolphin


People also ask

What does comment mean in C?

What Is Comment In C Language? A comment is an explanation or description of the source code of the program. It helps a developer explain logic of the code and improves program readability. At run-time, a comment is ignored by the compiler.

What does /* mean in C++?

Comments in C++ C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compiler. C++ comments start with /* and end with */.

What does cc in a letter mean?

At the bottom of a business letter, cc would be followed by the names of the people who were sent carbon copies of the original, so the recipients would know who else received it. In the context of email, cc indicates the other recipients to whom the message was sent.

What is a comment in C++?

In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program; Comments are statements that are not executed by the compiler and interpreter. In C/C++ there are two types of comments : Single line comment; Multi-line comment; Single line Comment. Represented as // double forward ...

How do I use comments in my code?

Use comments to document your code. This example is a comment accepted by the compiler: /* Comments can contain keywords such as for and while without generating errors. */ Comments can appear on the same line as a code statement: You can choose to precede functions or program modules with a descriptive comment block:

What is a C-style comment?

It is referred to as C-Style comment as it was introduced in C programming. /*Comment starts continues continues . . . Comment ends*/ Example: This example goes same for C and C++ as the style of commenting remains same for both the language.

What is the importance of comments in programming languages?

A person reading a large code will be bemused if comments are not provided about details of the program. Comments are a way to make a code more readable by providing more description. Comments can include a description of an algorithm to make code understandable.


1 Answers

Generally, < is Doxygen's syntax for documentations that come after the item that they document.

An example from the "Putting documentation after members" section of the Doxygen documentation:

int var; /**< Detailed description after the member */

What's curious about the example you gave, though, is that it uses a normal comment block (/*) as opposed to a documentation block (e.g., /**). I suspect this is an oversight of the author of this specific example. Alternatively, it might be that the author extends this convention from documentation blocks to all comments similar in nature.

like image 187
L. F. Avatar answered Sep 21 '22 19:09

L. F.