incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: design of testuite exceptions (was: Re: svn commit: r418319 - /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp)
Date Sun, 16 Jul 2006 20:46:21 GMT
Farid Zaripov wrote:
>   Light update of the exception.cpp:
> 
> ExceptionBase& ExceptionBase::operator= (const ExceptionBase& ex) :
> if strdup() is failed then copy string to the internal buf_ with truncate.

strdup() is not a standard C or POSIX function so we should avoid
it in favor of a standard alternative (e.g., strlen/malloc/memcpy).

As for making a deep copy, I think a reference-counted implementation
might be more suitable here so as to avoid having to dynamically
allocating storage when the exception object is thrown or rethrown.

Other than that, I think the exception changes are good to commit.

Thanks!
Martin

PS One thing to look into is formatting the text of the exception's
what string directly into the what_ buffer instead dynamically
allocating it only to free it later. I believe rw_asnprintf has
the ability to use the provided buffer if it's large enough.

Mime
View raw message