Re: [PATCH 2/4] Change return type of gdbarch_software_single_step to vector<CORE_ADDR>

Simon Marchi
2017-04-19T04:08:46Z

On 2017-04-18 16:17, Pedro Alves wrote:
> On 04/16/2017 03:14 PM, Simon Marchi wrote:
>> This is a relatively straightforward patch that changes
>> gdbarch_software_single_step so it returns an std::vector<CORE_ADDR>
>> instead of a VEC (CORE_ADDR).
>
> LGTM.
>
> BTW, FYI, in general, {} initialization of vectors may not
> always be a good idea. See e.g.:
>
>
> https://akrzemi1.wordpress.com/2016/07/07/the-cost-of-stdinitializer_list/
>
> C++17 will make it better (though not fully ideal).
>
> But in this case CORE_ADDR is a scalar and it doesn't really
> matter.

Ouch, that's good to know.

From what I understand, using {} to return an empty vector has no extra
cost though, so we can use that without any problem.

Simon