[Development] Binary Compatibility question (KDE)

Tony Van Eerd tvaneerd at blackberry.com
Thu Feb 27 21:06:04 CET 2014


Sorry, there is probably a KDE email list or something that I should post this to, but I know it is very closely related to Qt:

On http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B there is:

You cannot...

- For existing functions of any type:
	- add an overload (BC, but not SC: makes &func ambiguous), adding overloads to already overloaded functions is ok (any use of &func already needed a cast).

There is another issue - implicit casting. ie

Foo.hpp // old
	int foo(const char * ptr);

MyCode.cpp
	#include <Foo.hpp>
	int x = foo(NULL);


Foo.hpp // NEW (1)
	int foo(const char * ptr);
	int foo(Bar *);

MyCode (same as above) now has SC break - "ambiguous function call"

Foo.hpp  // NEW(2) - WORSE
	int foo(const char * ptr);
	int foo(int);

MyCode.cpp now still compiles, *but calls a different function!* -  foo(int), as NULL is 0 is an int, and that is a closer match that foo(const char *).


Anyone care?  Where should I forward this email to?

Thanks,
Tony








More information about the Development mailing list