Re: What is the output of this program?
Alf P. Steinbach wrote:
* kanze:
According to the standard, std::isalpha takes two arguments, and
works with char, signed or not.
Nope. The std::isalpha (presumably) used by the OP takes one argument.
And doesn't work well with signed char.
But that one is a hold-over from C. It's the one he's using,
but that's because he forgot the second argument.
In practice, of course, you don't want to use the one from the C
library because of it's problem with typing (and in many cases
thread safety). If you've grown up on C++ (not my case), you
may not even be aware that it exists.
In a loop, you probably don't want to use the one in the C++
library directly either. It's far preferrable to get the ctype
facet, and use it directly. But the issues aren't that clear,
and I can easily see a beginner using it directly.
--
James Kanze GABI Software
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]