On Friday 20 April 2007 11:19, Joerg Schilling wrote:

> In the Solaris STL lib, std::string.clear() and std::string.erase()
> do the same: delete on the allocated space.
>
> In the GCC STL lib, std::string.clear() only resets pointers and
> keeps the allocated memory while std::string.erase() deletes the
> allocated space.
>
> People wo develop with GCC rely on this fact and having two
> different STL libs could be a bit difficult.....

Could you please explain what you mean by "People who develop with GCC 
rely on this fact" and could you please also clarify which particular 
instance of std::basic_string::erase() you are referring to, since 
there are 3 of them, and each one of them does different things.

There are several implementations of STL which work with GCC. Relying 
on any private implementation detail artifact of a particular STL 
implementation goes against the entire point of OO programming, C++ 
and STL, and it is not a C++ ABI compatibility problem. It is simply 
a lousy programming practice problem.

Also, the Standard clearly states that std::basic_string::clear() 
behaves as if std::basic_string::erase(begin(), end()) would have 
been called [21.3.3.13].

--Stefan

-- 
Stefan Teleman                  'Nobody Expects the Spanish Inquisition'
KDE e.V.                                                -Monty Python
[EMAIL PROTECTED]
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to