Skip to content

Commit db37986

Browse files
author
Pavel Kovalenko
committed
Add C++ comment conventions.
1 parent 4d21154 commit db37986

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

doc/procedure/cpp_comment.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
TITLE: C++ Comments Coding Conventions
2+
3+
Good comments
4+
=============
5+
Generally, it's best to let the code itself explain what it does, whereas
6+
the comments are there to describe why it's like that. Do not write comments
7+
that don't add to the reader's understanding of what's going on.
8+
9+
XXX comments
10+
============
11+
Oftentimes, when you're in the middle of implementing something and you don't
12+
want to distract on the details that should be implemented or improved in
13+
future, add an XXX comment:
14+
15+
strcpy_s(params, sizeof(params), GetCommandLine());
16+
// XXX: allocate dynamically to handle long command lines
17+
18+
For one thing, this tells anyone reading your code that it's still unstable,
19+
and also points out where the known problems are. For another, if you don't
20+
mark the problems now, they'll be a lot harder to find a week or a year from
21+
now, when you're ready to revisit your old code.

0 commit comments

Comments
 (0)