Skip to content
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

Merged
merged 1 commit into from
Oct 13, 2018

Conversation

refack
Copy link
Contributor

@refack refack commented Oct 7, 2018

Suggested words about outside coding guidelines, and set their priorities.
Fixes: #22862

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@refack refack added c++ Issues and PRs that require attention from people who are familiar with C++. doc Issues and PRs related to the documentations. discuss Issues opened for discussions and feedbacks. meta Issues and PRs related to the general management of the project. labels Oct 7, 2018
@refack refack self-assigned this Oct 7, 2018
* [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)
Copy link
Member

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)

### Memory allocation
## Semantics

The Node.js C & C++ code strives to be consistent in it's use of language
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: its

Copy link
Contributor Author

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.


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`.
Copy link
Member

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.

Copy link
Contributor Author

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.

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
Copy link
Member

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/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automatic teller machine*

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:
Copy link
Member

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.

Copy link
Contributor Author

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.

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
Copy link
Member

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?

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based of -> based on?


Coding guidelines are based of following guides (highest priority first):
1. This document
2. The [Google C++ Style Guide][](GCSG)
Copy link
Contributor

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)?

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)
Copy link
Contributor

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]>
@refack
Copy link
Contributor Author

refack commented Oct 13, 2018

@refack refack removed the discuss Issues opened for discussions and feedbacks. label Oct 13, 2018
@refack refack merged commit 0f8eaa4 into nodejs:master Oct 13, 2018
@refack refack deleted the cpp-guideline-references branch October 13, 2018 22:15
@addaleax
Copy link
Member

@refack In case you missed it: #22255

@refack
Copy link
Contributor Author

refack commented Oct 13, 2018

It's a week old.
Ohh, it's just 6 days, my bad.

addaleax pushed a commit that referenced this pull request Oct 14, 2018
with explicit priorities

PR-URL: #23317
Reviewed-By: Anna Henningsen <[email protected]>
jasnell pushed a commit that referenced this pull request Oct 17, 2018
with explicit priorities

PR-URL: #23317
Reviewed-By: Anna Henningsen <[email protected]>
@refack refack removed their assignment Oct 20, 2018
MylesBorins pushed a commit that referenced this pull request Oct 30, 2018
with explicit priorities

PR-URL: #23317
Reviewed-By: Anna Henningsen <[email protected]>
@refack refack changed the title [WIP] doc,meta: add references to outside C++ guides doc,meta: add references to outside C++ guides Nov 13, 2018
@codebytere codebytere mentioned this pull request Nov 27, 2018
rvagg pushed a commit that referenced this pull request Nov 28, 2018
with explicit priorities

PR-URL: #23317
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
with explicit priorities

PR-URL: #23317
Reviewed-By: Anna Henningsen <[email protected]>
@codebytere codebytere mentioned this pull request Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. doc Issues and PRs related to the documentations. meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

c++: Adopt the CppCoreGuidelines
6 participants