[PATCH 08/18] malloc: Add specialized dynarray for C strings

Pedro Alves palves@redhat.com
Thu Aug 17 14:48:00 GMT 2017


On 08/17/2017 11:12 AM, Florian Weimer wrote:

> There is a lot of complexity in this code to maintain the invariant that
> the stored array is NUL-terminated.  It also means that the dynarray
> functions must not be used directly.
> 
> std::string in C++ has a c_str() method which adds the null termination
> on demand.  

Depends on what you mean by C++.  std::string::c_str() must not throw
and must be constant time since C++11.

Thanks,
Pedro Alves



More information about the Libc-alpha mailing list