Do all string functions from Run-Time Library are already included in
<iostream> and <string>? Do <iostream> and <string> have missing
functions such as isdigit() and isalpha? Or are they already included
<cctype>?
I guess you may not recommend to use C and C++ legacy. Use Standard C+
+ Library instead of Run-Time Library.
> I believe that all global functions come with Run-Time Library are C
> programming.
No, not all of them. For example, std::getline is pure C++.
> The programmer includes <stdio.h> if they want to use
> printf function. Why do C++ programming offer <cstdio>? Is it for C
> and C++ legacy?
http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.4
Note that many developers here still prefer <stdio.h> over <cstdio>.
Just browse archived postings for discussions on this topic.
> Do all string functions from Run-Time Library are already included in
> <iostream> and <string>?
<string> and <string.h>/<cstring> are very different headers. <string>
is a pure C++ header that is included for using the std::string class,
while <string.h>/<cstring> contains C functions for char* manipulation.
If you need functions for working directly with char*, then you need
<string.h>/<cstring>. However, in C++ those functions are less relevant
than in C because you have std::string.
> Do <iostream> and <string> have missing
> functions such as isdigit() and isalpha?
No.
> Or are they already included
> <cctype>?
You cannot count on automatic inclusion of other headers.
> I guess you may not recommend to use C and C++ legacy. Use Standard C+
> + Library instead of Run-Time Library.
You've got a runtime library, anyway! :)
Also, <stdio.h>/<cstdio> etc. *are* part of the C++ standard library as
well. So what you actually meant to say was "use pure C++ functionality
instead of C components". Generally, yes. But there are exceptions, of
course.
http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.16
--
Christian Hackl
ha...@sbox.tugraz.at
Milano 2008/2009 -- L'Italia chiam�, s�!
> > I believe that all global functions come with Run-Time
> > Library are C programming.
> No, not all of them. For example, std::getline is pure C++.
Not to mention <algorithm>.
[...]
> > Do <iostream> and <string> have missing functions such as
> > isdigit() and isalpha?
> No.
> > Or are they already included <cctype>?
> You cannot count on automatic inclusion of other headers.
More precisely, a standard header defines exactly what the
standard says it defines, and (not necessarily) any more. In
C++, a standard header is free to include other standard
headers; this liberty is not granted to the C standard headers,
however, so if you only include <stdio.h> or <cstdio>, you are
guaranteed that <ctype.h> or <cctype> have not been included.
--
James Kanze