[PATCH 2/2] Use obstack in ada_encode_1

Joel Brobecker brobecker@adacore.com
Fri Oct 9 20:14:31 GMT 2020


> Yeah, actually it is probably a better API to simply return a new
> string.  I avoided this since I wasn't sure about why the function is
> the way it is -- is it to avoid the difficulties of managing an
> allocation in C, or is it to avoid extra allocations?  But I looked at
> the callers and I think it will be fine.

FWIW, a lot of it was before I started working on GDB, but my
understanding was that this was really meant to help managing
allocation lifetime, which as we know is tricky in C. If std::string
makes sense, I would indeed use that. I don't think this area is
a hot-spot during performance-sensitive operations.

-- 
Joel


More information about the Gdb-patches mailing list