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.