-
Notifications
You must be signed in to change notification settings - Fork 70
Fix the various misuage of size_t #950
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
Conversation
|
Appreciate the effort in trying to cut these down, but... this is a lot of churn, not obviously fixing any bugs. A few things concern me:
Here's my advice, in order of preference: (1) Disable the /W option that is producing these spam warnings. |
|
Since my goal is to keep the warnings active and eventually enable I kept I cannot poke further at this for now, but as soon as I'm able I'll update this PR. |
|
It's a poor tradeoff to potentially introduce subtle bugs to fix problems that don't exist. Disabling the warnings or changing compilers is your best bet. I wouldn't bother with the lexer. I'd entertain a look at the vm/ fixes but it'll take time to carefully audit each change. |
|
I'm having troubles understanding how we could introduce potential bug by limiting the range of all the As I'm very willing to see this through and input as much effort as you'd expect from me to ensure your worries are quelled. I don't know the codebase so I'm sure you're justified in your concerns. My intention isn't to give a false sense of fixing bugs with this PR, that has never been the goal. I'd like to satisfy the compilers so we stop using warning supressors. I do believe its overkill to enable a global warning surpression flag, because we've a dozen of lines in the sourcepawn/amtl submodule that would make the compiler yell. All the while those warnings could have been useful into other sections of the larger sourcemod project, which could have potentially indicated bugs to the code contribution's author. So if we don't address the issue by converting all
I suppose I'm going to roll with the 1st solution, and edit the |
|
"I'm having troubles understanding how we could introduce potential bug by limiting the range of all the size_t variables" It could cause overflows, eg: Changing The change in the binary search code to use My point is this stuff is hard to audit, it takes time, and the changes can be invasive. If there are actual bugs here, let's fix them properly. You're the boss of the compiler, not vice versa :) |
I can absolutely agree with that. Despite closing this PR, I definitively want to come back to this at some point. It'd be nice not to surpress warnings, and if that means I've to rewrite some sections of the codebase to ensure overflows can't happen instead of convenient c-cast then I will. I'll apply this mindset to sourcemod and amtl first though, since they're the two projects I'd really like to remove warning surpressors from. |
Currently working on a PR for Sourcemod that aims at enabling
/WXon msvc, this means dealing with the various narrowing or extending of variables, when compiling the project on 64 bits.The warnings are mostly
size_ttounsigned intconversion, which are no longer valid.