speaking of C++...

Subject: speaking of C++...
From: Joaquín Cuenca Abela (cuenca@celium.net)
Date: Sun Apr 15 2001 - 14:22:32 CDT

ok, I've been debuggin ~2 hours to fix this one...

NEVER call a virtual method from a constructor.

In the constructor of XAP_EncodingManager & XAP_UnixEncodingManager we
can found a single line:
{ initialize(); }

I don't know why g++ was so severely screwed to build a non-sense object
file (maybe is due to my version) instead of just build a version that
calls the base method, and I don't know why it worked before my changes,
but it seems to me obvious that the author of this class wanted to call
the XAP_EncodingManager::initialize method from the XAP_EncodingManager
ctor and XAP_UnixEncodingManager::initialize from the
XAP_UnixEncodingManager ctor, BUT initialize actually is a VIRTUAL
method (and it took me ~2 hours fighting with the debugger to realize

So, please, try to avoid virtual methods calls from ctors and dtors.


Joaquín Cuenca Abela  (who has a heavy headache...)

This archive was generated by hypermail 2b25 : Sun Apr 15 2001 - 14:22:41 CDT