What does the 3-bar C++ comment mean?

Asked

Viewed 586 times

11

I know there are basically 2 types of comments, those of a line // and the multilines /* */, however if I comment with 3 bars until the color of the comment changes, for example below Qt and Visual Studio:

Qt creator

Visual studio

If the color changes there must be a reason for this, then what kind of comment would this?

3 answers

12


In visual studio the 3 bars indicate documentation, not just comment. It is used to embellish comments that will be formatted specifically through your editor or some other tool like documentation for a class, method, namespace, etc. That is, after the 3 bars you would want to put the project documentation ;)

8

If the 3-bar comment is equal to the C#, I believe it is to document in a way that generates XML documents.

Behold at this link how to insert XML comments for documentation generation.

3

Normally three bars are used when creating documentation for your code. You can use Doxygen for this. Doxygen There are some specific tags that are used to define how the document will be generated. Below is an example of a snippet with the Brief tags, param Return

/// \brief This metafunction converts degrees to radians.
/// \param T angle in degrees.
/// \return T angle in radians.
template <typename T>
constexpr inline T degreeToRadians(const T angle)
{
    return angle * ((PI<T>) / 180);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.