[RFA 1/8] Add gdb_ref_ptr.h

Pedro Alves palves@redhat.com
Fri Dec 2 13:08:00 GMT 2016


On 11/29/2016 05:05 AM, Tom Tromey wrote:
> This adds a new gdb_ref_ptr.h, that implements a reference-counting
> smart pointer class, where the user of the class supplies a
> reference-counting policy object.
> 
> This class will be used in the next patch, which changes most explicit
> BFD reference counts to use this new type.  Meanwhile, this patch
> changes gdbpy_ref to be a specialization of this new class.
> 
> This change required adding new nullptr_t overloads some operators in
> gdb_ref_ptr.h.  I suspect this was needed because some Python header
> redefines NULL, but I'm not certain.

Can you please remove them and see what breaks?  Odd that this would be
something about Python, given the class is being used in Python code
today?

BTW, it's worth noting that there's a proposal to add (an oddly named)
policy-based intrusive ref counting smart pointer to the standard:

 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0468r0.html

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list