The header ctype.h in the ANSI C Standard Library for the C programming language contains declarations for character classification functions.
Welcome to CWAnswers
CWAnswers is your guide to the sprawling world wide web. The directory aims to provide a useful guide made by users. You can share your knowledge as well - simply sign up and edit your first entry. For questions just contact the team at support - at - cwanswers.com.
Weblinks for Ctype
Top 10 for Ctype
Things about Ctype you find nowhere else.
Select content modules
How to improve a DotNetNuke module
This article explains how to make changes to DotNetNuke modules varying their ... sqlDataProvider As Blog.Data.SqlDataProvider = CType( Blog.Data.DataProvider. ...dotnetslackers.com/articles/dotnetnuke/Improve_a_DotNetNuke_...SlotForum -> Jaguar C Type and D Type
SlotForum > Community Blog > ferrari1950's Blog > Jaguar C Type and D Type. ferrari1950 ... The C type required judicious placement of lead, trimming of ...www.slotforum.com/forums/blog/ferrari1950/index.php?showentr...Validation with CType
*$/', $first_name) ... Blog Post. Blogs " PHP " Validation with CType " Extending Red Hat 7 - 9 with Progeny ... and opinions in this blog post are those of ...www.sitepoint.com/blogs/2004/05/11/validation-with-ctype/C Type Blog Entries // Blog Post Tag Search // BlogCatalog
... 000 Blog Entries containing the term: c type. 1,000 Social Entries containing the term: c type. Help Contact Advertise Developers BlogCatalog Blog TOS BlogCatalog ...www.blogcatalog.com/post-tag/c%20type/Eli Bendersky's website " Blog Archive " Reading C type declarations
Reading C type declarations. July 18th, 2008 at 11:22 am. C is not an easy language to parse. ... under the hood of C type declarations, read sections A.8.5 ...eli.thegreenplace.net/2008/07/18/reading-c-type-declarations...The header ctype.h in the ANSI C Standard Library for the C programming language contains declarations for character classification functions.
History
Early toolsmiths writing in C under Unix began developing idioms at a rapid rate to classify characters into different types. For example, in the ASCII character set, the following test identifies a letter:
However, this idiom does not necessarily work for other character sets such as EBCDIC.
Pretty soon, programs became thick with tests such as the one above, or worse, tests almost like the one above. A programmer can write the same idiom several different ways, which slows comprehension and increases the chance for errors.
Before long, the idioms were replaced by the functions in
Implementation
Unlike the above example, the character classification routines are not written as comparison tests. In most C libraries, they are written as static table lookups instead of macros or functions.
For example, an array of 256 eight-bit integers, arranged as bitfields, is created, where each bit corresponds to a particular property of the character, e.g., isdigit, isalpha. If the lowest-order bit of the integers corresponds to the isdigit property, the code could be written thus:
Early versions of Linux used a potentially faulty method similar to the first code sample:
This can cause problems if x has a side effect---for instance, if one calls isdigit(x++) or isdigit(run_some_program()). It would not be immediately evident that the argument to isdigit is being evaluated twice. For this reason, the table-based approach is generally used.
The difference between these two methods became a point of interest during the SCO v. IBM case.
The contents of
The isdigit and isxdigit are locale-specific; their behavior may change if the locale changes.
The Single Unix Specification Version 3 adds functions similar to the above:
Incorrect usage
The standard states (§7.4-1):
- In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined.
Unfortunately many programmers forget that a char type may be either signed or unsigned, depending on the implementation. If the char types are signed, the implicit conversion from char to int may generate negative values, resulting in undefined behavior. That usually means that if the argument is used as an index to a lookup table, it will access an area outside of the correct table, and may even crash the program.

























