summaryrefslogtreecommitdiff
path: root/CPP_STYLE_GUIDE.md
diff options
context:
space:
mode:
authorMatheus Marchini <matheus@sthima.com.br>2017-12-11 17:25:09 -0200
committerRuben Bridgewater <ruben@bridgewater.de>2017-12-15 19:39:52 -0200
commita17f4264121bf8ed77d8fb7aee080a7339bf89ad (patch)
tree0192d254f4acf1dca7aab3954092fec60a9b92db /CPP_STYLE_GUIDE.md
parent6918fff9c91efb6b3fb7a4b4b9ac928d63d9b89b (diff)
downloadandroid-node-v8-a17f4264121bf8ed77d8fb7aee080a7339bf89ad.tar.gz
android-node-v8-a17f4264121bf8ed77d8fb7aee080a7339bf89ad.tar.bz2
android-node-v8-a17f4264121bf8ed77d8fb7aee080a7339bf89ad.zip
doc: add C++ style comments to the style guide
Adds instructions on how to format C++ comments to the C++ style guide, as `cpplint.py` doesn't complain about C-style comments on the code. PR-URL: https://github.com/nodejs/node/pull/17617 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'CPP_STYLE_GUIDE.md')
-rw-r--r--CPP_STYLE_GUIDE.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md
index 62c96a8fd1..6266ee03b7 100644
--- a/CPP_STYLE_GUIDE.md
+++ b/CPP_STYLE_GUIDE.md
@@ -4,6 +4,7 @@
* [Formatting](#formatting)
* [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations)
+ * [C++ style comments](#c-style-comments)
* [2 spaces of indentation for blocks or bodies of conditionals](#2-spaces-of-indentation-for-blocks-or-bodies-of-conditionals)
* [4 spaces of indentation for statement continuations](#4-spaces-of-indentation-for-statement-continuations)
* [Align function arguments vertically](#align-function-arguments-vertically)
@@ -33,6 +34,26 @@ these rules:
`char* buffer;` instead of `char *buffer;`
+## C++ style comments
+
+Use C++ style comments (`//`) for both single-line and multi-line comments.
+Comments should also start with uppercase and finish with a dot.
+
+Examples:
+
+```c++
+// A single-line comment.
+
+// Multi-line comments
+// should also use C++
+// style comments.
+```
+
+The codebase may contain old C style comments (`/* */`) from before this was the
+preferred style. Feel free to update old comments to the preferred style when
+working on code in the immediate vicinity or when changing/improving those
+comments.
+
## 2 spaces of indentation for blocks or bodies of conditionals
```c++