-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Resolve different signedness warning #21944
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
base: main
Are you sure you want to change the base?
Resolve different signedness warning #21944
Conversation
The size() by default returns an unsigned integer datatype. In other places in this code a C cast style is used. Follow the same resolution, and cast the unsigned integer type to signed integer.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Proposal for solving #21938 |
@@ -177,7 +177,7 @@ void GenerateLarge( | |||
}}, | |||
{"aliases", | |||
[&] { | |||
for (int i = 0; i < aliases.size(); i++) { | |||
for (int i = 0; i < (int)aliases.size(); i++) { |
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.
how about size_t i = 0;
without the cast?
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 totally agree with the proposal of size_t
. However the rest of the code in this file uses a C cast and I just wanted to 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.
@sbenzaquen wdyt?
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.
Using the suggested solution size_t i = 0;
without the cast.
The size() by default returns size_t datatype. Update the data type for the loop iterator to resolve compiler warning for signedness mismatch.
The size() by default returns an unsigned integer datatype. In other places in this code a C cast style is used. Follow the same resolution, and cast the unsigned integer type to signed integer.