-
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
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
@ethanyzhang imported this issue into IBM GitHub Enterprise |
67a80e5
to
9bb06f3
Compare
158b1f8
to
2313697
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.
This is a code generated file. We will have to change the code generation logic instead.
Please remove this file from the PR.
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.
Good catch, Added change to mustache file ProtocolToThrift-cpp.mustache thank you!
9c300a8
to
2eec3f6
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
@jkhaliqi : Lets wait until the builds pass to submit this code. |
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