incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Far...@kyiv.vdiweb.com>
Subject RE: design of testuite exceptions (was: Re: svn commit: r418319 - /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp)
Date Mon, 17 Jul 2006 15:51:37 GMT
 

> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Sunday, July 16, 2006 11:46 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: design of testuite exceptions (was: Re: svn 
> commit: r418319 - 
> /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp)
> 
> 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.

  Unfortunately, rw_asnprintf cannot use buffer with automatic or static
storage.
rw_asnprintf calls rw_vasnprintf which calls _rw_bufcat. If the buffer
size is too small
the _rw_bufcat allocates the memory using malloc() and unconditionally
calls free() for
the old buffer. Moreover the _rw_bufcat allocates the memory including
the guard block
(printf.cpp line 425) and even if the initial buffer was allocated using
malloc()
RW_ASSERT (printf.cpp line 461) will terminate the execution in the
debug
configurations.

Farid.

Mime
View raw message