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: [PATCH] Introduce gdb::byte_vector, add allocator that default-initializes


On 09/09/2017 08:11 PM, Simon Marchi wrote:
> On 2017-06-14 12:21 PM, Pedro Alves wrote:
>> On 06/14/2017 09:39 AM, Simon Marchi wrote:
>>
>>> Thanks for the detailed explanation.  It's all very logical, but it's
>>> also full of small details essential to really understand what's happening.
>>
>> Yeah...  As custom with "library" code, thankfully uses of the types
>> can remain oblivious to how the types work under the hood.
>>
>> I've pushed the patch in now, with the trivial adjustments to both
>> dwarf2loc.c, after Andreas' series, and to make the new int128_t printing
>> code use gdb::byte_vector.
> 
> Hi Pedro,
> 
> I am looking at Tom's recent patch that uses def_vector, and I am wondering
> if there should be a check somewhere to make sure we don't use the
> default_init_allocator with non-default-constructible types.  Let's say we use
> def_vector with a trivial type, and then we later decide to make that type
> non-trivial by defining a constructor.  It looks like it would still build,
> but I suppose we shouldn't use that type in a def_vector (for the same reason
> that we shouldn't allocate it with malloc).  It could easily go unnoticed for
> a while.

It'd be unnecessary to use def_vector, but also harmless.
value vs default initialization only makes a difference for types _without_
constructors.  Default initialization of a type with a default
constructor also runs the default constructor, just like value
initialization.

Thanks,
Pedro Alves


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