| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Rely on the V8 garbage collector to take care of managing the lifetime of the underlying memory of an `AliasedBuffer`.
|
@addaleax build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/2662/pipeline |
Sorry, something went wrong.
Sorry, something went wrong.
|
|
||
| // allocate new native buffer | ||
| NativeT* new_buffer = Calloc<NativeT>(new_capacity); | ||
| NativeT* new_buffer = static_cast<NativeT*>(ab->GetContents().Data()); |
There was a problem hiding this comment.
Sorry, something went wrong.
There was a problem hiding this comment.
We've made a decision about being explicit if the type is not too verbose: https://github.com/nodejs/node/blob/master/CPP_STYLE_GUIDE.md#using-auto
Sorry, something went wrong.
There was a problem hiding this comment.
But in current codebase, it's already used this way
Line 235 in c70e853
Sorry, something went wrong.
There was a problem hiding this comment.
Also used by v8 by default
Line 7 in 9b4bf7d
Sorry, something went wrong.
There was a problem hiding this comment.
@gengjiawen The example in node_platform.cc you’re referring to uses a more complex type – I would agree with using auto for that. Generally, we’re not being super consistent here, and we’ve had debates about this before. ;)
I think auto would be okay here too, because the static_cast makes things a bit more obvious, but I still think NativeT* is simple enough as a type to be kept this way.
(Basically, I agree with what the linked clang docs are saying, I just think NativeT* is short enough for me.)
Sorry, something went wrong.
There was a problem hiding this comment.
There is an option MinTypeNameLength, disscuss it's value to make auto rule more consistent ?
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html#options
Sorry, something went wrong.
There was a problem hiding this comment.
@gengjiawen It’s just my opinion, but my gut feeling would be something like 10 or 12 characters or so, and only to use auto when the type is obvious (e.g. from new Something() or when using a cast).
Sorry, something went wrong.
Sorry, something went wrong.
|
Resume CI again: https://ci.nodejs.org/job/node-test-pull-request/20937/ |
Sorry, something went wrong.
Rely on the V8 garbage collector to take care of managing the lifetime of the underlying memory of an `AliasedBuffer`. PR-URL: #26196 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rely on the V8 garbage collector to take care of managing the lifetime of the underlying memory of an `AliasedBuffer`. PR-URL: #26196 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rely on the V8 garbage collector to take care of managing the lifetime of the underlying memory of an `AliasedBuffer`. PR-URL: #26196 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Rely on the V8 garbage collector to take care of managing
the lifetime of the underlying memory of an AliasedBuffer.
Checklist