This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: using C++ STL containers in GCC/gfortran source code


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]