[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Fwd: Re: Argh!
From:       Graham TerMarsch <gtermars () home ! com>
Date:       1998-09-10 13:59:32
[Download RAW message or body]

Sirtaj Singh Kang wrote:
> > I'm fairly familiar with the STL that comes with 2.7.2, and have fought many
> > times with the String class that it provides and the quirks that are needed to
> > get it to compile cleanly on other systems.
> 
> "String" is not the same as "string"! String seems to be a GNU class and
> is not part of STL AFAIK. The one you and everyone else should be using is
> string.
> 
> The biggest difference between String and string is that String has an
> implicit const char * conversion operator, so you can replace it with C
> strings very easily. With string you need to use the c_str() function
> wherever you need a const char * to the string data (there is no implicit
> conversion).

Exactly, and with two different versions of string/String sitting around on
your machine, both of which provide extremely similar interfaces, it's hard to
figure out which one is the right one to use.  As well, bear in mind that
_most_ STL implementations of the string class have serious problems regarding
reference counts; this was part of the reason for a GNU String class. 
Personally, considering all of the headaches that I've had with the
string/String classes, I'd prefer to use one that's completely different from
the two of them and just try and get it to integrate well; I recall that
'string' had problems when used in some STL containers with gcc2.7.2 as it
tried to do template instantiation during compilation and caused problems in
some containers (yay, another sporadically wonky class).

-- 
Graham TerMarsch

// -----------------------------------------------------------------
// No yak too dirty; no dumpster too hollow.   
// -----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic