Skip to content

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Oct 22, 2018

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

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. labels Oct 22, 2018
@danbev
Copy link
Contributor Author

danbev commented Oct 22, 2018

&hints);
if (err)
delete req_wrap;
if (!err)
Copy link
Member

Choose a reason for hiding this comment

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

err == 0 (ditto line 2025)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll fix this shortly.

@danbev
Copy link
Contributor Author

danbev commented Oct 23, 2018

@refack
Copy link
Contributor

refack commented Oct 23, 2018

I'm not sure this code is correct. unique_ptr has ownership semantics, it's not an RAII tool. It's not clear who owns the wraps.

From our style guide:
R.20: Use unique_ptr or shared_ptr to represent ownership

refack
refack previously requested changes Oct 23, 2018
Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

Please use RAII without ownership semantics

@refack refack dismissed their stale review October 23, 2018 16:11

I'm not sure...

@danbev
Copy link
Contributor Author

danbev commented Oct 29, 2018

Please use RAII without ownership semantics

I think the code is clear as it is without using RAII, and there have been quite a few approvals for this PR. I'm happy to change if others feel the same way though.

@refack
Copy link
Contributor

refack commented Oct 29, 2018

Please use RAII without ownership semantics

I think the code is clear as it is without using RAII, and there have been quite a few approvals for this PR. I'm happy to change if others feel the same way though.

IIUC you are using unique_ptr for RAII. IMHO it's not the best pattern, but AFAICT it is the best we have implemented in our code ATM. So I withdrew my objections.

Since our style guide states:
R.30: Take smart pointers as parameters only to explicitly express lifetime semantics
R.20: Use unique_ptr or shared_ptr to represent ownership
All I ask is for clarifying comments, about why that guideline is broken.

@danbev
Copy link
Contributor Author

danbev commented Oct 30, 2018

@danbev
Copy link
Contributor Author

danbev commented Nov 2, 2018

Landed in 226a41a.

@danbev danbev closed this Nov 2, 2018
@danbev danbev deleted the cares_smart_pointers branch November 2, 2018 09:54
danbev added a commit that referenced this pull request Nov 2, 2018
PR-URL: #23813
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
targos pushed a commit that referenced this pull request Nov 18, 2018
PR-URL: #23813
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
PR-URL: #23813
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Dec 5, 2018
4 tasks
codebytere pushed a commit that referenced this pull request Jan 13, 2019
PR-URL: #23813
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
@codebytere codebytere mentioned this pull request Jan 15, 2019
codebytere pushed a commit that referenced this pull request Jan 29, 2019
PR-URL: #23813
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
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++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants