On Fri, Dec 16, 2016 at 06:52:03PM +0000, Pedro Alves wrote:
> GDB has a string_printf function that prints into a std::string, for
> example. Like:
>
> std::string hello = string_printf ("%s", "hello world");
>
> That's a function that many C++ projects reinvent.
If you then want to work with it as std::string object, sure, it makes
sense. But if all you want is to pass the string to %s of another
formatting function and free it, then going through std::string
doesn't add many benefits over just xasprintf + free.
Jakub