[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Update needed to binary compatibility guide for Windows?
From:       Michael Pyne <mpyne () kde ! org>
Date:       2014-04-14 1:36:13
Message-ID: 2618143.Qob8pVN347 () midna
[Download RAW message or body]

Hi all,

In the past couple of days our Binary Compatibility in C++ TechBase page [1] 
was posted to Reddit [2].

That post received a response [3] which indicated that we're actually missed a 
potential source of binary incompatibility with virtual functions on Windows 
with MSVC.

Specifically, that adding an override of an existing virtual function in a 
class may cause other vtable function entries to be re-ordered. E.g. in 
something like:

class blah
{
public:
    virtual void func1(int arg);
    virtual void func2(int arg);
    virtual void func3(int arg);
};

Adding a virtual override "func2(char *arg)" to the *end* might cause the 
vftable to line up as if declared in this order:

class blah
{
public:
    virtual void func1(int arg);
    virtual void func2(int arg);
    virtual void func2(char *arg);
    virtual void func3(int arg); // moved
};

Is anyone able to confirm this behavior on Windows? If it's true, do we want 
to adopt a constraint on our handling of virtual functions in leaf classes 
based on this? (Adding virtual methods is already not permitted for non-leaf 
classes)

Regards,
 - Michael Pyne

[1] http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
[2] 
http://www.reddit.com/r/cpp/comments/22rpjd/binary_compatibility_issues_with_c/
[3] 
http://www.reddit.com/r/cpp/comments/22rpjd/binary_compatibility_issues_with_c/cgq9iyo 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic