Home

For reasons related to python/swig and garbage collecting I want to
remember every object in a linked list. I have a common base class
RCObj which in turn has a static std::list<RCObj*> memory.

My problem is that I cannot get RCObj store the true this pointer. Even
if I pass it explicitly from a derived class (called "Part") as in:

Part::Part() {
this->RCObj::init(this);

the pointer that arrives at RCObj::init() is not the same as "this"
inside Part::Part()

(gdb) p this
$4 = (pyramid::Part * const) 0x81b62e0
(gdb) s
RCObj::init (this=0x81b6378, that=0x81b6378) at common.cc:65

I assume C++ treats an object as composed of several sections one of
which is the RCObj section and is silently add an offset (0x81b6378 -
0x81b62e0 = 152) to "this" if this shall be treated as an RCObj.

(1) what happens when I "delete this" from within the RCObj scope? Will
it only delete part of the object?
(2) how can I possibly keep track of all my created objects?

previous
next

Re: curiosity singleton pattern?
finding out the call (and not only the caller)
Re: Un(der)documented bits of cgi.py
Re: sorteddict PEP proposal [started off as orderedict]
Re: Overloading operator->
Mimo Wszystko
Fundacja Sloneczko
Akogo
Dzieci Niczyje
Fundacja Avalon