|
|
Wherever possible and appropriate, existing library functions were extended to include locale-dependent behavior. These functions came in two groups: those declared by the ctype.h header (character classification and conversion), and those functions that convert to and from printable and internal forms of numeric values, for example, printf() and strtod().
All ctype.h
predicate functions except isdigit()
and isxdigit()
are allowed to return nonzero
(true)
for additional characters when the LC_CTYPE
category of the current locale is other than "C"
.
In a Spanish locale, isalpha('ñ')
should be true.
Similarly the character conversion functions tolower()
and toupper())
should appropriately handle any extra alphabetic characters
identified by the isalpha()
function.
(As an implementation note,
the ctype.h
functions are almost always macros that
are implemented using table lookups
indexed by the character argument.
Their behavior is changed by resetting the table(s)
to the new locale's values,
and therefore there is no performance impact.)
Those functions that write or interpret printable floating values
may change to use a
decimal-point character
other than
period (.)
when the LC_NUMERIC
category of the current locale is other than
"C"
.
There is no provision for converting any numeric values to printable form
with thousands separator-type characters,
but when converting from a printable form to an internal form,
implementations are allowed to accept such additional forms,
again in other than the "C"
locale.
Those functions that make use of the decimal-point character are
the printf()
and scanf()
families, atof(),
and strtod().
Those functions that are allowed implementation-defined extensions are
atof(),
atoi(),
atol(),
strtod(),
strtol(),
strtoul(),
and the
scanf()
family.
(ANSI C currently defines no such extensions.)