|
Boost : |
Subject: Re: [boost] [afio] Formal review of Boost.AFIO
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-08-31 19:33:09
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.
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".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk