[eq-dev] Affecting Collage objects outside an Equalizer application

Daniel Nachbaur danielnachbaur at googlemail.com
Wed Feb 29 00:01:49 CET 2012


Hi,

with the unit test added by Stefan it is pretty good reproducable with
VS2008/2010 and 32bit at least on my machine. The compiler actually
throws a warning that there might be something fishy:

http://msdn.microsoft.com/en-us/library/1s6193tt(v=vs.80).aspx

As I did not see this warning ever in my life, I just started
investigating what's the deal with that. Basically, it's a problem of
member function pointers used within (multiple) inheritances. As there
is no proper support for member functions pointers being a real C++
feature like a delegate in other languages, it's up to the compiler to
deal with that. It even gets more complicated if virtual functions or
virtual inheritance is involved...
For further reading:
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/05a59a5f-1370-418f-9460-e4dd49d19ddf/
http://www.codeproject.com/Articles/7150/Member-Function-Pointers-and-the-Fastest-Possible

 So it's up to the compiler vendors to handle this issue
appropriately. Of course, Microsoft has some "solutions" for this:

http://msdn.microsoft.com/en-us/library/ck561bfk%28VS.80%29.aspx

Imo, this not really practical, so the only portable solution is
reordering the interheritance, meaning the base class used for the
function binding (aka dispatcher in this case) has to be very first. A
remaining question on this is what gcc for instance is doing about
this whole issue?

A solution on the library side would be thinking about using something
similar like boost.function, which from what I read so far should have
no problem with this particular problem, as boost.bind used for
creating the actual binding is due its implementation aware of the
complete class hierarchy.

Cheers,
Daniel



More information about the eq-dev mailing list