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

src: document required else block at src/node_platform.cc #34688

Closed

Conversation

juanarbol
Copy link
Member

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

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Aug 9, 2020
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

This is not redundant because it moves the task out of the InternalCallbackScope in the case in which env is available.

@BridgeAR
Copy link
Member

BridgeAR commented Aug 9, 2020

@addaleax since the code is now run after the if statement, does it not behave the same as before?

@addaleax
Copy link
Member

addaleax commented Aug 9, 2020

@BridgeAR No – this is als the cause of the failures in the WASI tests here, I assume.

More generally, in C++

if (x) {
  some_variable a;
  do_something(); 
} else {
  do_something(); 
}

and

if (x) {
  some_variable a;
}
do_something(); 

are not equivalent if the constructor/destructor of a influence do_something() in some way (which is the case here).

@juanarbol
Copy link
Member Author

Hey @addaleax thank you!! I was asking why it did break WASI tests.

Closing.

@juanarbol juanarbol closed this Aug 9, 2020
@addaleax
Copy link
Member

addaleax commented Aug 9, 2020

@juanarbol Fwiw, you’re not the first one who ran into this, so it might be worth adding a comment here that this is intentional (especially considering that this PR already had 4 approvals)

@juanarbol juanarbol reopened this Aug 10, 2020
src/node_platform.cc Show resolved Hide resolved
@juanarbol juanarbol force-pushed the juanarbol/remove-else-block branch from 4209ff9 to 24fba59 Compare August 24, 2020 16:16
@juanarbol juanarbol changed the title src: remove redundant else block src: document required else block at src/node_platform.cc Aug 24, 2020
@juanarbol juanarbol requested a review from addaleax August 24, 2020 16:17
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@juanarbol juanarbol added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2020
@nodejs-github-bot
Copy link
Collaborator

@addaleax addaleax added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 30, 2020
@github-actions github-actions bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 30, 2020
@addaleax
Copy link
Member

Landed in 535989e

@addaleax addaleax closed this Sep 30, 2020
addaleax pushed a commit that referenced this pull request Sep 30, 2020
PR-URL: #34688
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 6, 2020
PR-URL: #34688
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@danielleadams danielleadams mentioned this pull request Oct 6, 2020
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
PR-URL: nodejs#34688
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@juanarbol juanarbol deleted the juanarbol/remove-else-block branch January 19, 2021 16:27
@targos targos removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 5, 2021
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++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.