[LLVMbugs] [Bug 9510] New: Warning for ctype.h misuse
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Mar 18 17:48:26 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9510
Summary: Warning for ctype.h misuse
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: joerg at NetBSD.org
CC: llvmbugs at cs.uiuc.edu
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).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list