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

Fix use of <ctype.h> functions #105

Closed
wants to merge 1 commit into from

Conversation

sebhub
Copy link
Contributor

@sebhub sebhub commented Jul 27, 2023

The value passed to the <ctype.h> functions shall be the value of an unsigned char or EOF. It is implementation-defined if the char type is signed or unsigned. Cast to unsigned char to avoid undefined behaviour on systems where char is signed.

This cast is already present in other parts of the code base.

Close #71.

The value passed to the <ctype.h> functions shall be the value of an unsigned
char or EOF.  It is implementation-defined if the char type is signed or
unsigned.  Cast to unsigned char to avoid undefined behaviour on systems where
char is signed.

This cast is already present in other parts of the code base.

Signed-off-by: Sebastian Huber <[email protected]>
@dgibson
Copy link
Owner

dgibson commented Jul 28, 2023

It seems pretty nuts to me that you can't safely use functions explicitly designed to test characters on values of type char. But I guess that's the weird history of the C library for you.

Merged.

@dgibson dgibson closed this Jul 28, 2023
@dgibson dgibson self-assigned this Jul 28, 2023
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.

Char subscript error in Cygwin
3 participants