Re: [RFC - Python Scripting] Extend Value.dereference to dereference C++ reference values

Tom Tromey
2012-03-12T21:04:30Z

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Siva> Unless I am missing something, I couldn't find anything which can do
Siva> this in the Python API. Attached is a patch which extends the Python
Siva> API method Value.dereference to 'dereference' C++ reference values as
Siva> well. I am probably overloading the term 'dereference' as used in the
Siva> normal (pointer dereferencing) sense.

Tom> I think that is fine.
[...]
Tom> The code bits are ok with those changes.

Oops, sorry, I am mistaken about this.

Right now, value_ind calls coerce_array, which calls coerce_ref.
So, if you have a reference to a pointer, Value.dereference will end up
dereferencing the pointer.
So, if your patch went in, it would be an incompatible change.

I think you will have to have a new method for this instead.

Tom