4.2 Diagnostics  -< ANSI C Rationale  -> 4.4 Localization                          Index 

4.3  Character Handling  <ctype.h>

Pains were taken to eliminate any ASCII dependencies from the definition of the character handling functions.  One notable result of this policy was the elimination of the function isascii, both because of the name and because its function was hard to generalize.  Nevertheless, the character functions are often most clearly explained in concrete terms, so ASCII is used frequently to express examples. 

Since these functions are often used primarily as macros, their domain is restricted to the small positive integers representable in an unsigned char, plus the value of EOF EOF is traditionally -1, but may be any negative integer, and hence distinguishable from any valid character code.  These macros may thus be efficiently implemented by using the argument as an index into a small array of attributes. 

The Standard (§4.13.1) warns that names beginning with is and to, when these are followed by lower-case letters, are subject to future use in adding items to <ctype.h>

4.3.1  Character testing functions

The definitions of printing character and control character have been generalized from ASCII. 

Note that none of these functions returns a nonzero value (true) for the argument value EOF  The isalnum function  The isalpha function

The Standard specifies that the set of letters, in the default locale, comprises the 26 upper-case and 26 lower-case letters of the Latin (English)  alphabet.  This set may vary in a locale-specific fashion (that is, under control of the setlocale function, §4.4 so long as  The iscntrl function  The isdigit function  The isgraph function  The islower function  The isprint function  The ispunct function  The isspace function

isspace is widely used within the library as the working definition of white space.  The isupper function  The isxdigit function

4.3.2  Character case mapping functions

Earlier libraries had (almost equivalent) macros, _tolower and _toupper, for these functions.  The Standard now permits any library function to be additionally implemented as a macro; the underlying function must still be present.  _toupper and _tolower are thus unnecessary and were dropped as part of the general standardization of library macros.  The tolower function  The toupper function

4.2 Diagnostics  -< ANSI C Rationale  -> 4.4 Localization                          Index