This is the mail archive of the 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: [users/palves/cxx-target_ops] Convert struct target_ops to C++

>>>>> "Pedro" == Pedro Alves <> writes:

Pedro> The other week I started converting struct target_ops to
Pedro> use C++ virtual methods and inheritance instead of tables
Pedro> of function pointers.

This is great.

I took a look at it.  It's much cleaner than the approach I took on my
old multi-target branch.  Removing to_xclose and converting everything
is more ambitious but, IMO, really paid off.

I wonder how you plan to handle target life cycles.  In my approach, I
made to_xclose a sentinel, meaning that an "xclose" target could be
"delete"d when popped.

One idea would be not to have any singleton targets.  However, then
there's another issue, namely that sometimes targets do a kind of
"instanceof" check -- see the (few remaining) target_is_pushed calls.

Maybe you can just use RTTI.  How nice to have C++ now :)

Getting rid of singletons would mean removing all the things like

A couple minor notes --

I still saw a reference to "to_data" in a comment.

Naming a method "wait" may trip up on platforms where this is a #define.


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