[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[4]: [lmi] Why does this crash?
From: |
Vadim Zeitlin |
Subject: |
Re[4]: [lmi] Why does this crash? |
Date: |
Tue, 20 Apr 2010 23:06:00 +0200 |
On Tue, 20 Apr 2010 20:06:00 +0200 Vaclav Slavik <address@hidden> wrote:
VS> On Sat, 2010-04-17 at 18:45 +0200, Vadim Zeitlin wrote:
VS> > > The second problem could be fixed by returning a value -- in light
VS> > > of the principle you brought up, this should be backward compatible
VS> > > and not result in any problems (or am I missing something?).
VS> >
VS> > I don't see any reason to not do this and it would be an improvement
VS> > IMHO.
VS>
VS> I missed one thing: we need to implement both operator*() and
VS> operator->(). And while the former can be done easily, the latter must
VS> return a pointer.
Or something that implements operator->(). But this probably doesn't help
here :-(
VS> Or -- and this may actually be a good idea -- store xml::node in
VS> xmlNode's _private field (for app data) the first time it is accessed.
VS> This would fix both issues naturally and would speed up repeated access
VS> to the same node. And because xml::node creation already involves
VS> dynamic allocation, it could probably be done without degrading
VS> performance...
I don't know libxml API really well but why do we need dynamic allocation,
couldn't we simply store the pointer to xml::node itself directly in
_private? I'm probably missing something obvious here...
Anyhow, à priori it looks like a good idea to use _private field for
storing this backpointer, this is what it is there for.
Regards,
VZ