-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
Description
Bugzilla Link | 9510 |
Version | trunk |
OS | Linux |
Extended Description
One of the most often misused APIs in C is ctype.h. A lot of programmers don't understand the value range of the functions and the following code fragments are seen over and over again:
char c;
isalpha(c);
isalpha((int)c); // Attempt to pacify the compiler warning on some systems
Correct usage is:
isalpha((unsigned char)c)
if EOF can be ruled out. Above is valid only if a check for ASCII was done before (e.g. with isascii).