[RFA 15/23] Use std::vector to avoid cleanups

Tom Tromey tom@tromey.com
Sun Jul 23 16:06:00 GMT 2017


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> It still pains me a little to see std::vector used when we're going to
Pedro> fill in the data anyway, because std::vector value/zero-initializes,
Pedro> which is pointless in these cases.  :-)  I think I'll need to accept
Pedro> that people dislike the idea of unique_ptr<gdb_byte[]>, so I'll stop
Pedro> mentioning that, though at some point I think I may propose an
Pedro> allocator that default-initializes, and then I'll nag people
Pedro> to use _that_, like:

I've updated the patch to use this where appppropriate.

Pedro> So the patch all looks good to me, but it seems to me that in this
Pedro> particular case, making this buffer be a std::string would clarify
Pedro> the code:
[...]

I made this change as well.

Tom



More information about the Gdb-patches mailing list