Re: Will therefore GDB utilize C++ or not?

Paul_Koning
2012-05-18T19:44:24Z

On May 18, 2012, at 3:20 PM, Tom Tromey wrote:

>>>>>> "Paul" == <Paul_Koning@Dell.com> writes:
>
> Tom> For example, look at the Python layer. Despite patch review and our
> Tom> knowledge of the issues, we still have error-checking and
> Tom> reference-counting bugs in the code. You can go through the list
> Tom> archives and find them.
>
> Paul> How would C++ help with reference counting bugs? I could see how it
> Paul> might (or might not) help with the subset related to error handling
> Paul> that can be made clearer with exceptions. But the reference counting
> Paul> errors I remember were straight algorithmic mistakes that, as far as I
> Paul> can see, would have existed in the exact same form if the algorithm
> Paul> had been expressed in C++.
>
> We'd use RAII to ensure that refcounts were automatically managed by the
> C++ compiler.

That would be nice if the Python ABI is compatible with this. It may not be, or not always. For example, when some calls steal a reference while others (most of them) don't, and some return a borrowed reference while others return a new one, it isn't clear how a mechanical scheme like RAII will give you a full answer. Maybe if you use only the subset that does reference counting in the one way you want it done? There would be some performance impact but probably not much.

paul