Re: <string.h> vs <string>
On 2008-04-03 01:50:28 -0400, "Jim Langston" <tazmaster@rocketmail.com> said:
Carmen Sei wrote:
it seem to me that when doing include -
#include <string.h> - is CRT
#inlcude <string> - is C++ standard library
Is that true those header with .h extension is CRT and those without
extension <string> is C++ standard library headers?
Not always. An OS/Compiler specific header may have a .h or not, usually
they do though.
Most headers without an extention are part of the STL.
Some headers with an .h extention are from the C routines.
However, the standard C headers can be included by adding a 'c' to the front
and removing the exteion. I.E.
#include <string.h>
becomes
#include <cstring>
So how would you catagorize cstring?
Let me restate that. Among the headers defined in the C++ standard:
Headers without an extension describe names in the C++ standard library.
Headers with a .h extension describe names in the C standard library,
and put those names in the global namespace.
Headers with names that are the same as the C headers but with a 'c' in
front and no extension put names from the C standard library into
namespace std.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)