Re: speaking of C...


Subject: Re: speaking of C...
From: Andrew Dunbar (hippietrail@yahoo.com)
Date: Sun Apr 15 2001 - 21:08:51 CDT


Joaquín Cuenca Abela wrote:
>
> 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
> it).

I've never been a fan of Hungarian notation but if we're using it
why are we not prefixing virtual functions with v_ ? Isn't this
what it's for?

Andrew.

-- 
http://linguaphile.sourceforge.net

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




This archive was generated by hypermail 2b25 : Sun Apr 15 2001 - 21:07:18 CDT