Am 01.09.2015 1:33 vorm. schrieb "Gavin Lambert"
On 1/09/2015 02:57, Thomas Heller wrote:
You don't appear to understand well how ABI stable C++ is designed. It requires imposing costs on everybody. Look at the PIMPL idiom.
The PIMPL idiom has absolutely *nothing* to do with ABI stability.
This is incorrect.
PIMPL is one essential tool in maintaining public ABI stability, as it
allows the size of the private members of a type to become irrelevant to the ABI size of the public type, and therefore permitted to vary without breaking ABI compatibility. Just to be on the safe side here, we are talking about ABI compatibility between different versions of your library, right? Not between versions of your library linked against different runtimes? If yes, I stand corrected.
Granted, it has other purposes as well (such as breaking header
dependency chains for build time improvement, or enforcing certain kinds of ownership semantics), but this is a vital one (if ABI stability is important to you).
Unfortunately, hiding the implementation from external code also carries
a downside, as simple get/set methods can no longer be inlined in the public headers and the compiler is given fewer opportunities to optimise. Hence "imposing costs on everybody".
_______________________________________________ Unsubscribe & other changes: