Skip to content
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

phase: models: use signed char instead of char #243

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

rwk-unil
Copy link
Contributor

Because the C/C++ standard does not specify the signedness of the char type the results will be compiler/machine dependent this can lead to unexpected behaviour.

Use signed char instead of char to avoid these cases.

References :

Fixes : #242

Because the C/C++ standard does not specify the signedness
of the char type the results will be compiler/machine dependent
this can lead to unexpected behaviour.

Use signed char instead of char to avoid these cases.

References :
https://stackoverflow.com/questions/2054939/is-char-signed-or-unsigned-by-default
https://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/C-Dialect-Options.html
https://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf

Fixes : odelaneau#242

Signed-off-by: Rick Wertenbroek <[email protected]>
@srubinacci srubinacci merged commit f72ff67 into odelaneau:master Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The use of "char" to hold signed values can lead to unexpected behaviour
2 participants