This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 15/23] Use std::vector to avoid cleanups
- From: Tom Tromey <tom at tromey dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Sun, 23 Jul 2017 10:06:46 -0600
- Subject: Re: [RFA 15/23] Use std::vector to avoid cleanups
- Authentication-results: sourceware.org; auth=none
- References: <20170503224626.2818-1-tom@tromey.com> <20170503224626.2818-16-tom@tromey.com> <51da6cfd-42c9-536b-17b0-dbd9998e0ff4@redhat.com>
>>>>> "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