Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ difference between '//' and '///' [duplicate]

Tags:

c++

codeblocks

Why in Code::Blocks at least '///' is dark blue and '//' is blue? and i have seen in some source codes that sometimes they use '///' and other times '//'.

like image 781
Roberto Jaimes Avatar asked Mar 15 '26 08:03

Roberto Jaimes


2 Answers

It means nothing to C++, its the same as the traditional //. The /// is typically used for documentation. For codeblocks, it triggers a highlighting mode for Doxygen..

// Normal comment
/// Doxygen comment
//! Doxygen comment

/*! Doxygen comment block */
like image 83
WhiZTiM Avatar answered Mar 17 '26 21:03

WhiZTiM


For the C++ compiler both are just comments.

But, source code documentation tools like doxygen might handle them in different ways.

Example:

  • /// -> special comment block, eg: function documentation
  • // -> standard comment

/// tells doxygen that this comment shall be part of the generated documentation.

like image 20
sergej Avatar answered Mar 17 '26 21:03

sergej