[Development] Binary Compatibility question (KDE)
Christoph Feck
christoph at maxiom.de
Thu Feb 27 21:12:17 CET 2014
On Thursday 27 February 2014 21:06:04 Tony Van Eerd wrote:
> 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
You are right, but what is your actual question?
Christoph Feck (kdepepo)
KDE Quality Team
More information about the Development
mailing list