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 1/2] Add unit test to aarch64 prologue analyzer


Yao Qi writes:

> On Wed, Nov 30, 2016 at 06:53:08AM -0500, Antoine Tremblay wrote:
>> >> Also I wonder if we need to specify the default constructor explicitly ?
>> >> Is there a rationale for it?
>> >> 
>> >> It's never used too, unless you apply my previous comment.
>> >
>> > The instruction_reader_test default constructor is never used.  How
>> > about using "= delete"?
>> >
>> >     instruction_reader_test () = delete;
>> >     instruction_reader_test (std::initializer_list<uint32_t> init)
>> >       : insns{init} {}
>> 
>> Yes that would be more appropriate if we're going to specify that.
>> 
>> I just wrote a patch with a C++ class and did not include explicit
>> default constructors do you think we should make it a code convention to
>> explicitly specify their existence or non-existence (=default, =delete) ?
>
> If you don't want default constructor to be used, "=delete" is useful,
> IMO, which tells compiler not to generate the default constructor.  The
> intention is quite clear that I don't want you to use the default
> constructor.
>

OK.

> Using "=default" is not that clear.  I personally prefer to write code
> in an explicit way, so I prefer putting "=default" at the end.
>
>> 
>> I could not find mention of that in GCC's C++ conventions...
>
> IMO, using "=default" is a personal programming habit, so it is
> reasonable not to mention it in C++ code conventions.

OK thanks for the clarification.

The patch LGTM.


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