This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/5] Introduce gdbpy_subclass and use it to simplify some logic
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 24 Jan 2017 15:21:48 -0500
- Subject: Re: [RFA 3/5] Introduce gdbpy_subclass and use it to simplify some logic
- Authentication-results: sourceware.org; auth=none
- References: <20170115134253.24018-1-tom@tromey.com> <20170115134253.24018-4-tom@tromey.com>
On 2017-01-15 08:42, Tom Tromey wrote:
This introduces a new typed variant of gdbpy_ref, called
gdbpy_subclass. This is then used to simplify logic in various parts
of the Python layer; for example removing repeated error code or
removing gotos.
I wouldn't mind a better than than "gdb_subclass". One idea was to
use gdb_ref with a default template parameter, and then change the
existing uses of "gdb_ref" to "gdb_ref<>".
Do you mean gdbpy_ref and gdbpy_subclass?
I don't really like gdbpy_subclass, I think there should be "ref" in the
name to be clear. So it could be gdbpy_subclass_ref. However, I find
gdbpy_subclass_ref<gdbpy_breakpoint_object> a bit long. As you may have
seen in my version of the patch, I had decided to keep gdbpy_ref for
PyObjects and introduce typedef for other types (gdbpy_inf_ref). So I
could see one called gdbpy_bp_ref.
Otherwise, I like gdbpy_ref<> and gdbpy_ref<gdbpy_breakpoint_object>.
The patch looked good to me otherwise (and confirmed that I still find
refcounting difficult).