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

warning: array subscript has type ‘char’ [-Wchar-subscripts] #7

Open
denisdemaisbr opened this issue May 26, 2023 · 0 comments
Open

Comments

@denisdemaisbr
Copy link

cc -Wall -std=c11 -o pixd pixd.c

In file included from pixd.c:2:
pixd.c: In function ‘parse_range’:
pixd.c:101:18: warning: array subscript has type ‘char’ [-Wchar-subscripts]
101 | if (!isdigit(*first) || end != delim) errx(1, "invalid start value in range %s", str);
| ^~~~~~
pixd.c:105:18: warning: array subscript has type ‘char’ [-Wchar-subscripts]
105 | if (!isdigit(*second) || *end != '\0') errx(1, "invalid end/size value in range %s", str);

to fix:

101 | if (!isdigit( (unsigned char) *first) || end != delim) errx(1, "invalid start value in range %s", str);
105 | if (!isdigit( (unsigned char) *second) || *end != '\0') errx(1, "invalid end/size value in range %s", str);

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

No branches or pull requests

1 participant