Three slashes for commenting blocks?

This was first noticed in Notepad ++, where // comments and /// comments were shown in different colors.
Doxygen showed more about this, but I'm not sure about its effectiveness.
1. Why would someone use three styles of cutting comments when it is much easier to type /* and */ ? (I suppose there should be a better explanation than it is useful when attaching comments)
2. So that it can be used, do editors support comment blocking for triple slashes in that Visual Studio supports Ctrl+k Ctrl+c for multi-line comments?

+6
source share
3 answers

Visual Studio /// displays documentation , not just comments. After your link, the explanation remains the same. It is used to format comments that will be specially formatted through your editor or some other tool as documentation for a class, method, namespace, etc.

+15
source

The author may intend to post the documentation after ///

In the place where I work, we use 3 styles of doxygen comment blocks for documentation, because there are no coding style rules.

  • ///
  • //!
  • / ** * /
+7
source
  • Of course, it is easier to hit it with the same key three times than to hit two separate keys.
  • I don't know about other IDEs, but Xcode4 supports code snippets where you can print almost anything. In Visual Studio, I use Visual Assist X, which gives me the same thing. Xcode4 Example, Visual AssistX Example . I must assume that other IDEs provide similar functionality.

However, yes, I also encountered triple slashes, and they are usually used to indicate comments that an automated documentation system, such as doxygen, could choose.

+4
source

Source: https://habr.com/ru/post/907905/


All Articles