[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string ???????



Steve Baker wrote:

> > It does. string.h is a C header containing the str*() family of
> > functions. It is found in /usr/include/string.h on my system.
> >
> > string is a C++ only header containing the string class. It is found in
> > /usr/include/g++-2/string on my system.
> 
> In general, the definitions in the header files with no '.h' suffix use
> the new C++ "Namespace" feature.  (Which is an ugly hack IMHO).
> 
> Hence the 'string' file is a C++ only thing - and you *should* be able
> to use 'string.h' from within a C++ program if you don't want to use
> namespaces.

Yes, you can use string.h from a C++ program with no problem, but only
if it is the str*() family of functions that you want. This person
wanted the "string" class, which is not in <string.h>, but only in
<string>.

And the <string> header doesn't use namespaces, it only has a single
definition in it, a typedef of a template into the "string" class.

-- 
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi