isalpha(0), etc

A

Alex

Is the result of the various isxxx() functions declared in <ctype.h> when
given an argument of 0 defined? And if so, how? Does locale make a
difference?

TIA,
Alex
 
R

Régis Troadec

"Alex" <[email protected]> a écrit dans le message de

Hi,
Is the result of the various isxxx() functions declared in <ctype.h> when
given an argument of 0 defined? And if so, how? Does locale make a
difference?

Yes, the chars classification functions provided by <ctype.h> can take 0 in
argument. The parameter of an isxxx() function shall be an int
representable as an unsigned char (0 is) or EOF, otherwise the behavior is
undefined. The behavior of all these functions may differ according to the
locale, but concerning isxxx(0), I don't think it should change something.

Regis
 
A

Alex

Régis Troadec said:
Yes, the chars classification functions provided by <ctype.h> can take 0
in argument. The parameter of an isxxx() function shall be an int
representable as an unsigned char (0 is) or EOF, otherwise the behavior is
undefined.

Sorry if I was not clear. Allow me to rephrase:

Are the return values of the isxxx() functions specified when called with an
argument of 0? If so, what are they? (eg they all return 0 except
iscntrl().)

Alex
 
R

Régis Troadec

Alex said:
Sorry if I was not clear. Allow me to rephrase:

Are the return values of the isxxx() functions specified when called with an
argument of 0? If so, what are they? (eg they all return 0 except
iscntrl().)

I beg your pardon, I'm sorry to have misunderstood you.
By reading the J.4 annex concerning locale specific behavior, I would say
that it's implementation defined (e.g all chars classification functions may
not return 0 if 0 is passed in argument as well as iscntrl() may not always
return true). The sets of control characters, printing characters and those
tested by the isxxx() may differ according to the implementation.
But I think that in most cases (and most of charsets), 0 stands for a
control character (NUL in ASCII) and that the isxxx() functions return 0
except iscntrl().

Regis
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top