isspace(0)

J

James Kuyper

I am trying to figure out if isspace(0) can ever return non-zero. I
found a discussion from 2007:

http://compgroups.net/comp.lang.c/can-isspace-0-ever-be-true/725672

Am I reading that correctly that there's nothing in the standard that
forbids a locale from defining 0 as a whitespace character?

6.4p3 defines what "white space characters" are; and that definition is
not locale-specific. However, except in the "C" locale, isspace()
returning true does NOT mean that its argument is a white space
character. It is allowed to also return true for a locale-specific set
of other characters, so long as they meet certain requirements. When a C
standard library function is supposed to use isspace() rather than 6.4p3
to determine whether to treat something as white space, the standard
always says so explicitly (7.21.6.2p8, 7.22.1.3p2, 7.22.1.4p2). This
might be a defect in the standard - I had expected to find many more
such citations than just those 3.

Tracing back, any additional character for which isspace() is true must
also be one for which islower(), isupper(), and isdigit() are all false
- which is certainly permitted for '\0'. I couldn't find anything
forbidding it - but I may be missing something.

Eric Sossman's message in that discussion is correct: "a locale-specific
set of characters" doesn't not mean the same thing as "a set of
locale-specific characters".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top