From kde-core-devel Mon Apr 14 01:36:13 2014 From: Michael Pyne Date: Mon, 14 Apr 2014 01:36:13 +0000 To: kde-core-devel Subject: Update needed to binary compatibility guide for Windows? Message-Id: <2618143.Qob8pVN347 () midna> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=139743929609586 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