GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: document nullptr comparisons in style guide by addaleax · Pull Request #23805 · nodejs/node

Conversation

@addaleax

@addaleax addaleax commented Oct 21, 2018

Copy link
Copy Markdown
Member

This documents existing practices.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@addaleax
doc: document nullptr comparisons in style guide
48b53fb
This documents existing practices.
@nodejs-github-bot

nodejs-github-bot commented Oct 21, 2018

Copy link
Copy Markdown
Collaborator

@addaleax build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/1326/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to Node.js documentation. label Oct 21, 2018
@addaleax addaleax mentioned this pull request Oct 21, 2018
src: refactor out some warnings from FillStatsArray and node_file.h #23793
Merged
2 tasks done
@addaleax addaleax added the c++ Issues and PRs that require attention from people who are familiar with C++. label Oct 21, 2018
@refack

refack commented Oct 21, 2018

Copy link
Copy Markdown
Contributor

I thought we agreed to adopt the C++ Core Guidelines exactly to close the omissions in the style guide, and have explicit and well reasoned guidelines.
So this is change the current guideline ES.87: Don’t add redundant == or != to conditions to the opposite.

Could you provide reasons for this change?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax

addaleax commented Oct 21, 2018

Copy link
Copy Markdown
Member Author

Could you provide reasons for this change?

What is says in the PR description. It documents what we currently have. Preferring to document existing style before working on changes was also what was echoed as a sentiment in the last TSC meeting.

I thought we agreed to adopt the C++ Core Guidelines exactly to close the omissions in the style guide, and have explicit and well reasoned guidelines.

We agreed to link these documents since they provide meaningful guidelines. They do not match our current style in all cases; for those cases, we have this very document.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig approved these changes Oct 22, 2018
View reviewed changes
Comment thread CPP_STYLE_GUIDE.md

Use explicit comparisons to `nullptr` when testing pointers, i.e.
`if (foo == nullptr)` instead of `if (foo)` and
`foo != nullptr` instead of `!foo`.

@cjihrig cjihrig Oct 22, 2018

Copy link
Copy Markdown
Contributor

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.

For consistency, maybe make this if (foo != nullptr) and if (!foo).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@addaleax addaleax Oct 24, 2018

Copy link
Copy Markdown
Member Author

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.

@cjihrig yup, done!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jasnell
jasnell approved these changes Oct 22, 2018
View reviewed changes
@addaleax addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Oct 24, 2018
refack
refack reviewed Oct 24, 2018
View reviewed changes

@refack refack left a comment

Copy link
Copy Markdown
Contributor

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 would like to ask for a reference for where this guideline came from, and what is it's reasoning.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@addaleax

addaleax commented Oct 24, 2018

Copy link
Copy Markdown
Member Author

@refack This is, as the PR says, an existing practice that we follow. I can only speculate about the reasons why it was introduced, but it does follow the general “explicit is better than implicit” rule, and makes clear whether a check tests a pointer or a boolean.

The origins of the rule definitely predate my time around here (and I’m not so sure about their relevance). @bnoordhuis might know.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danbev
danbev approved these changes Oct 25, 2018
View reviewed changes
@danbev

danbev commented Oct 25, 2018

Copy link
Copy Markdown
Contributor

Landed in 24cb1f3.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danbev danbev closed this Oct 25, 2018
danbev pushed a commit that referenced this pull request Oct 25, 2018
@addaleax @danbev
doc: document nullptr comparisons in style guide
24cb1f3
This documents existing practices.

PR-URL: #23805
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
targos pushed a commit that referenced this pull request Oct 26, 2018
@addaleax @targos
doc: document nullptr comparisons in style guide
50d54f5
This documents existing practices.

PR-URL: #23805
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@targos targos mentioned this pull request Oct 27, 2018
Release proposal: v11.1.0 #23922
Merged
targos pushed a commit that referenced this pull request Nov 1, 2018
@addaleax @targos
doc: document nullptr comparisons in style guide
49b32af
This documents existing practices.

PR-URL: #23805
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
This was referenced Nov 2, 2018
2018-11-02 Version 11.1.0 (Current) @targos beevelop/docker-android-nodejs#245
Closed
2018-11-02 Version 11.1.0 (Current) @targos beevelop/docker-android-nodejs#246
Closed
2018-11-02 Version 11.1.0 (Current) @targos beevelop/docker-android-nodejs#247
Closed
2018-11-02 Version 11.1.0 (Current) @targos beevelop/docker-android-nodejs#248
Closed
@MylesBorins MylesBorins added dont-land-on-v8.x labels Nov 26, 2018
MylesBorins pushed a commit that referenced this pull request Nov 26, 2018
@addaleax @MylesBorins
doc: document nullptr comparisons in style guide
09faedf
This documents existing practices.

PR-URL: #23805
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@codebytere codebytere mentioned this pull request Nov 27, 2018
v10.13.1 proposal #24675
Closed
rvagg pushed a commit that referenced this pull request Nov 28, 2018
@addaleax @rvagg
doc: document nullptr comparisons in style guide
142ec03
This documents existing practices.

PR-URL: #23805
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
@addaleax @MylesBorins
doc: document nullptr comparisons in style guide
d830033
This documents existing practices.

PR-URL: #23805
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@codebytere codebytere mentioned this pull request Nov 29, 2018
v10.14.2 proposal #24727
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@cjihrig cjihrig cjihrig approved these changes
+2 more reviewers
@refack refack refack left review comments
@danbev danbev danbev approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. doc Issues and PRs related to Node.js documentation.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@addaleax @nodejs-github-bot @refack @danbev @jasnell @cjihrig @MylesBorins
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.