Skip to content

Commit

Permalink
Documentation: Update coding style rules about comments
Browse files Browse the repository at this point in the history
The requirement to use // for comments wasn't described anywhere, so now
it is! Also updated the rule about TODO comments because we've allowed
those for a while now.
  • Loading branch information
AtkinsSJ committed Nov 29, 2024
1 parent 971c04d commit 9903e9b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Documentation/CodingStyle.md
Original file line number Diff line number Diff line change
@@ -496,24 +496,31 @@ UniqueObject& my_unique_object(); // Free function.
### Comments
Make comments look like sentences by starting with a capital letter and ending with a period (punctuation). One exception may be end of line comments like this `if (x == y) // false for NaN`.
Comments should be written using `//` and not `/* */`, except for the copyright notice.
Make comments look like sentences by starting with a capital letter and ending with a period (punctuation). One exception may be end of line comments like this: `if (x == y) // false for NaN`
While we have no fixed rule about line length, please wrap long comments onto multiple lines so that they are easier to read.
Use FIXME: (without attribution) to denote items that need to be addressed in the future.
TODO: (without attribution) is also permitted.
###### Right:
```cpp
draw_jpg(); // FIXME: Make this code handle jpg in addition to the png support.
```

###### Wrong:
###### OK:

```cpp
draw_jpg(); // FIXME(joe): Make this code handle jpg in addition to the png support.
draw_jpg(); // TODO: Make this code handle jpg in addition to the png support.
```

###### Wrong:

```cpp
draw_jpg(); // TODO: Make this code handle jpg in addition to the png support.
draw_jpg(); // FIXME(joe): Make this code handle jpg in addition to the png support.
```

Explain *why* the code does something. The code itself should already say what is happening.

0 comments on commit 9903e9b

Please sign in to comment.