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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to