This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA 4/6] Simple cleanup removals in remote.c


On 2017-10-16 05:14 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
> 
> Simon> For this one, wouldn't it be easier to just go with a string?  Something like:
> 
> It's easier but less efficient.
> I wasn't sure if it mattered so I erred on the side of efficiency.
> 
> Tom
> 

I suppose you are talking about the += string_printf ()?  It's true that it's
not the most efficient, because the formatting is done in a separate buffer
(an std::string) and then copied, instead of directly in-place.  At least,
there's likely no dynamic memory allocation, because the string fits in
std::string's local buffer.

So since there's likely no real-world impact, I would've erred on the other
side.

In any case, I don't really mind, your version is good too and eliminates the
clean up, which is the main point.

Simon


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