-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: update example in module registration #17424
Conversation
17cdd4e
to
4517c71
Compare
doc/api/n-api.md
Outdated
|
||
// At this point the deferred has been freed, so we should assign NULL to it. | ||
deferred = NULL; | ||
deferred = nullptr; |
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.
Hm – I think this was intentionally C code? At least that’s what the ```c
seems to hint at…
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.
But the other examples have ```C
and use nullptr
. I'm assuming C
and c
are the same?
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.
Maybe change them all to ```C++
? (Yes, it's valid.)
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 think @addaleax's point is that this is mixing c and c++ code?
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.
@lpinca yes, but the other examples that are labeled as C
use nullptr
in this file as well, so we're using C++
most of the time anyways. I don't care what we use in the documentation, but it should be consistent throughout the file.
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.
The API must be usable from C, I'm wondering if we should make the examples C code to avoid any confusion over that but don't feel super strongly about that. Either way we should be consistent.
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.
@fhinkel if you want to restrict this PR to the original signature change I'm happy to take on going through to make sure we as consistent throughout the doc.
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`.
4517c71
to
fd2e875
Compare
@mhdawson I've restricted the change to the |
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.
LGTM
Landed in 2475676 |
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. PR-URL: #17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. PR-URL: #17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. PR-URL: #17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. PR-URL: #17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
@fhinkel FYI the If you want to note that something should go back to v8.x (which is great, please do add the labels), the one you want is |
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. PR-URL: #17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
@gibfahn Thanks! Sorry for using the wrong label. Thanks for fixing/cherry-picking. |
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. PR-URL: nodejs#17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Update return type of `Init` function in documentation to match `napi_addon_register_func` signature. Return type used to be `void`, now it is `napi_value`. Backport-PR-URL: #19447 PR-URL: #17424 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Update return type of
Init
function in documentation to matchnapi_addon_register_func
signature. Return type used to bevoid
, now it isnapi_value
.Checklist
make lint
(UNIX) passesAffected core subsystem(s)
doc