[tz] tabs vs spaces

Clive D.W. Feather clive at davros.org
Fri May 3 08:46:04 UTC 2013

James Cloos said:
> zic.c uses isascii(3) and isspace(3), so it is libc and locale dependent,
> although in practice the use of isascii(3) should minimize that dependence.
> Maybe even eliminate it.

"isascii" is not a C Standard function. The C Standard requires that all
the <ctype.h> functions work with all possible values of type unsigned
char and with EOF, so there is no need for "isascii".

> In the C and POSIX locales, ' ', '\f', '\n', '\r', '\t' and '\v'
> all are valid whitespace, as confirmed by various man pages.  The
> freebsd man page notes that that definition comes from ISO C90.

The C Standard says that, in the "C" locale, "isspace" is nonzero for those
6 characters and zero for all others. In other locales it may be nonzero
for other characters, but "isalnum(c) && isspace(c)" must always be 0.

[The above statements apply to the 1990, 1994, and 1999 editions of
ISO/IEC 9899.]

Clive D.W. Feather          | If you lie to the compiler,
Email: clive at davros.org     | it will get its revenge.
Web: http://www.davros.org  |   - Henry Spencer
Mobile: +44 7973 377646

More information about the tz mailing list