-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[native] Change C-style casts to C++-style #24237
base: master
Are you sure you want to change the base?
Conversation
a3998f5
to
2507ca2
Compare
b902b86
to
fd5d1eb
Compare
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.
Thanks @jkhaliqi. Had one comment about this change.
@@ -65,10 +65,10 @@ void toThrift(const std::vector<P>& p, std::vector<T>& t) { | |||
} | |||
|
|||
void toThrift(const protocol::TaskState& proto, thrift::TaskState& thrift) { | |||
thrift = (thrift::TaskState)((int)proto); | |||
thrift = (thrift::TaskState)(static_cast<int>(proto)); |
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.
Should there be a static_cast from int -> thrift::TaskState enum as well ?
Same comment for the line below also.
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.
Hey @aditi-pandit good catch, updated with the change, thank you!
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.
Thanks @jkhaliqi
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
Description
As per the security guideline in
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast
Covers the findings in the list from this issue and
closes #2493
Contributor checklist
Release Notes