(C++) comment

January 10, 2018 · View on GitHub

A comment is text in code that is written for only humans to read as a form of documentation.

/// main documentation (using Doxygen)
int main() 
{   
  //Single-line comment    
  /*    Multi-line comment    */
}
``` 

## [Advice](CppAdvice.md)

 * [Comment](CppComment.md) your code well [1]
 * [Comments](CppComment.md) are an important form of [documentation](CppDocumentation.md) [1]
 * [Document](CppDocumentation.md) the  [interfaces](CppInterface.md) so that they are able by others [2]
 * Keep the [comments](CppComment.md) crisp [3]
 * Don't say in [comments](CppComment.md) what can be clearly stated in code [4]
 * State intent in [comments](CppComment.md) [5].

## [References](CppReferences.md)

 * [1] [Bjarne Stroustrup](CppBjarneStroustrup.md). Programming. 2009. ISBN: 978-0-321-54372-1. Chapter 5.9.1: 'Comment your code well'
 * [2] [John Lakos](CppJohnLakos.md). Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.6: Document the interfaces so that they are usable by others. Have at least one other developer review each interface
 * [3] [Bjarne Stroustrup](CppBjarneStroustrup.md). The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 9.8. Advice. page 240: '[8] Keep comments crisp'
 * [4] [Bjarne Stroustrup](CppBjarneStroustrup.md). The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 9.8. Advice. page 240: '[9] Don't say in comments what can be clearly stated in code'
 * [5] [Bjarne Stroustrup](CppBjarneStroustrup.md). The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 9.8. Advice. page 240: '[10] State intent in comments'
 * [6] Trevor Misfeldt, Andrew Gray, Trevor Misfeldt. The Elements of C++ Style. 2004. ISBN: 978-0-521-89308-4. Chapter 34: Keep your comments and code synchronized