2

I have a header file in c++, where the declaration of the functions have block comments that start with "!" exclamation marks.

Example

class test{
 public:
        /*! @fn test::test()
            @brief The basic constructor, which initializes the _test handle.
        */
        test();

        /*! @fn test::upload(std::string url)
            @brief A function to execute a http POST request with the given url and image.

            @param[in] url The url we are POSTing to
            @return The response of the server
        */
        std::string upload(std::string url);
}

Also, it changes the color of the comment in VSCode like this:

enter image description here

What’s the purpose of the exclamation marks at the start of those comments?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
M.Zayed
  • 59
  • 5
  • 6
    From the perspective of C++, it doesn't mean anything. The contents of a comment are arbitrary. What's actually happening is that your IDE is treating the ! inside the comment as significant. The exact meaning and notational scheme it's working with therefore depend on your toolset and how it's been configured. – Nathan Pierson Dec 22 '22 at 18:26

1 Answers1

6

These comments are for the Doxygen system that automatically generates documentation from code.

Dan Bonachea
  • 2,408
  • 5
  • 16
  • 31