-
Notifications
You must be signed in to change notification settings - Fork 127
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
Fix numbers types #605
Fix numbers types #605
Conversation
24b0e78
to
01b895e
Compare
6146341
to
128b12e
Compare
d7b7ad8
to
ce3e9d2
Compare
Some possible followups:
I will try to do this unless you feel like it :) |
ce3e9d2
to
cf93441
Compare
@bluetech I agree, it showed multiple times already with
While I agree that would make our implementation more robust:
Do you have a realistic use case in mind? |
We can use strtoll then I suppose.
It's new in C23 so probably no one uses it yet, instead using gcc builtins or custom code.
Do you mean before or after this PR? I think that before, we are using int for both operands and result, so overflow is possible, and after, we are using int64_t for both operands and result, so overflow is still possible. Do I have it wrong? |
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.
Looks great! This was very much needed.
@bluetech I meant the int operations in XKB files, not the C23 functions.
You are right, but what I mean is that we do not expect the user to input numbers > 32 bits. So after we will handle 32 bits correctly, with some margin to handle overflow and report it. But if the |
Oh yes, there is definitely no real use case for doing such things. And the arithmetic isn't even allowed in many places. But I just feel bad about allowing user input to trigger UB (signed int overflow). We could use |
cf93441
to
e4c0c72
Compare
Avoid implicit conversion from `int64_t`.
The `Resolve*` functions do not always initialize the parameters that they can modify, so it is safer to always initialize them at the call site.
e4c0c72
to
b0ac4bd
Compare
@bluetech I tackled the |
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.
The extra changes LGTM
b0ac4bd
to
592ca3e
Compare
Latch batch for this PR. There are still cast warnings, but I leave it for a further PR. |
Note to self: check the Windows CI logs for further cast warnings! |
WIP, made public only to make you aware I am working on this.
Follow-up of #604 that is mostly a refactor of the parser for integers. Will probably split the minor refactoring in another PR.
Fixes #594