-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc,meta: add references to outside C++ guides #23317
Conversation
CPP_STYLE_GUIDE.md
Outdated
* [Memory allocation](#memory-allocation) | ||
* [Use `nullptr` instead of `NULL` or `0`](#use-nullptr-instead-of-null-or-0) | ||
* [Ownership and Smart Pointers](#ownership-and-smart-pointers) | ||
* [Others](#others) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I feel like this should be Semantics
and Memory Management
can be its own section?
(Also ideally we can have a section dedicated to C++/JS interactions and V8/libuv usage)
CPP_STYLE_GUIDE.md
Outdated
### Memory allocation | ||
## Semantics | ||
|
||
The Node.js C & C++ code strives to be consistent in it's use of language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit odd to put this section here...can we move it to the beginning of the document? We do inherit some formatting styles from Google's C++ style anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: its
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack x 2.
I'll try to reformat this.
CPP_STYLE_GUIDE.md
Outdated
|
||
In general code should follow the CPPCG, unless overridden by the GCSG or this | ||
document. ATM these guidelines are checked manually by reviewers, but the goal | ||
is to automate this check via tools such as `clang-tidy`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't mention clang-tidy
as a goal here since the last time I attempted to use it on our code base it took really long to complete linting...certainly much longer than cpplint and cpplint is already kind of slow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
Recent versions seems to work much much better. MSVS has it built in, and it runs in reasonable time (for just /src/
and with a limited ruleset). It does spit out a huge amount of recommendations.
CPP_STYLE_GUIDE.md
Outdated
3. The ISO [C++ Core Guidelines][](CPPCG) | ||
|
||
In general code should follow the CPPCG, unless overridden by the GCSG or this | ||
document. ATM these guidelines are checked manually by reviewers, but the goal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ATM/At the moment/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automatic teller machine*
5e72e11
to
546a42f
Compare
Unfortunately, the C++ linter (based on [Google’s `cpplint`][]), which can be | ||
run explicitly via `make lint-cpp`, does not currently catch a lot of rules that | ||
are specific to the Node.js C++ code base. This document explains the most | ||
common of these rules: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, you can remove this paragraph or merge it into the previous one, since it shares a lot of substance with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, I decided to keep it as is. I think it's better to keep semantic from formatting separate, even in this case.
CPP_STYLE_GUIDE.md
Outdated
2. The [Google C++ Style Guide][](GCSG) | ||
3. The ISO [C++ Core Guidelines][](CPPCG) | ||
|
||
In general code should follow the CPPCG, unless overridden by the GCSG or this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d prefer to spell out the abbreviations.
Also, maybe make it a bit clearer that our style guide is closest to the Google one?
CPP_STYLE_GUIDE.md
Outdated
features and idioms, as well as have some specific guidelines for the use of | ||
runtime features. | ||
|
||
Coding guidelines are based of following guides (highest priority first): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based of -> based on?
CPP_STYLE_GUIDE.md
Outdated
|
||
Coding guidelines are based of following guides (highest priority first): | ||
1. This document | ||
2. The [Google C++ Style Guide][](GCSG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space between the link and (GCSG)
?
CPP_STYLE_GUIDE.md
Outdated
Coding guidelines are based of following guides (highest priority first): | ||
1. This document | ||
2. The [Google C++ Style Guide][](GCSG) | ||
3. The ISO [C++ Core Guidelines][](CPPCG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
with explicit priorities PR-URL: nodejs#23317 Reviewed-By: Anna Henningsen <[email protected]>
4f9a027
to
0f8eaa4
Compare
It's a week old. |
with explicit priorities PR-URL: #23317 Reviewed-By: Anna Henningsen <[email protected]>
with explicit priorities PR-URL: #23317 Reviewed-By: Anna Henningsen <[email protected]>
with explicit priorities PR-URL: #23317 Reviewed-By: Anna Henningsen <[email protected]>
with explicit priorities PR-URL: #23317 Reviewed-By: Anna Henningsen <[email protected]>
with explicit priorities PR-URL: #23317 Reviewed-By: Anna Henningsen <[email protected]>
Suggested words about outside coding guidelines, and set their priorities.
Fixes: #22862
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes