-
Notifications
You must be signed in to change notification settings - Fork 30k
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: fix warnings in aliased_buffer #19665
Conversation
/cc @mike-kaufman FYI |
src/aliased_buffer.h
Outdated
inline Reference& operator-=(const NativeT& val) { | ||
const NativeT current = aliased_buffer_->GetValue(index_); | ||
aliased_buffer_->SetValue(index_, current - val); | ||
return *this; |
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.
Just curious, was this causing real issues? Unary minus on unsigned values should not really be an issue afaik, although I agree that being explicit is probably a good idea?
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.
No functional issue, I was just seeing a warning in VC++ and looking at the code it's not clear what the behavior is when values are unsigned. Looking around it appears to be speced behavior, but still didn't feel intuitive.
One more CI: https://ci.nodejs.org/job/node-test-pull-request/13951/ If there are no objections I plan to land this today. |
Landed in 0d64f33 |
* Unary minus usages on unsigned type * Implicit casts to/from input parameters PR-URL: #19665 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
I removed the template parameters from the operator overloads to push the burden of casting out of aliased buffer. It now expects the correct type to be passed to it and will generate warnings at the site rather than in the
AliasedBuffer
code.EDIT: These warnings were generated by the VC++ compiler.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes