Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2f51e49

Browse filesBrowse files
refackMylesBorins
authored andcommitted
doc,meta: add references to outside C++ guides
with explicit priorities PR-URL: #23317 Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 75d4bf2 commit 2f51e49
Copy full SHA for 2f51e49

File tree

Expand file treeCollapse file tree

1 file changed

+26
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-5
lines changed
Open diff view settings
Collapse file

‎CPP_STYLE_GUIDE.md‎

Copy file name to clipboardExpand all lines: CPP_STYLE_GUIDE.md
+26-5Lines changed: 26 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Table of Contents
44

5+
* [Guides and References](#guides-and-references)
56
* [Formatting](#formatting)
67
* [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations)
78
* [C++ style comments](#c-style-comments)
@@ -25,14 +26,30 @@
2526
* [Avoid throwing JavaScript errors in C++ methods](#avoid-throwing-javascript-errors-in-c)
2627
* [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods)
2728

28-
Unfortunately, the C++ linter (based on
29-
[Google’s `cpplint`](https://github.com/google/styleguide)), which can be run
30-
explicitly via `make lint-cpp`, does not currently catch a lot of rules that are
31-
specific to the Node.js C++ code base. This document explains the most common of
32-
these rules:
29+
30+
## Guides and References
31+
32+
The Node.js C++ codebase strives to be consistent in its use of language
33+
features and idioms, as well as have some specific guidelines for the use of
34+
runtime features.
35+
36+
Coding guidelines are based on the following guides (highest priority first):
37+
1. This document
38+
2. The [Google C++ Style Guide][]
39+
3. The ISO [C++ Core Guidelines][]
40+
41+
In general code should follow the C++ Core Guidelines, unless overridden by the
42+
Google C++ Style Guide or this document. At the moment these guidelines are
43+
checked manually by reviewers, with the goal to validate this with automatic
44+
tools.
3345

3446
## Formatting
3547

48+
Unfortunately, the C++ linter (based on [Google’s `cpplint`][]), which can be
49+
run explicitly via `make lint-cpp`, does not currently catch a lot of rules that
50+
are specific to the Node.js C++ code base. This document explains the most
51+
common of these rules:
52+
3653
### Left-leaning (C++ style) asterisks for pointer declarations
3754

3855
`char* buffer;` instead of `char *buffer;`
@@ -304,4 +321,8 @@ not inside of nested calls.
304321

305322
Using C++ `throw` is not allowed.
306323

324+
325+
[C++ Core Guidelines]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
326+
[Google C++ Style Guide]: https://google.github.io/styleguide/cppguide.html
327+
[Google’s `cpplint`]: https://github.com/google/styleguide
307328
[errors]: https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.