|
Boost : |
Subject: [boost] Seeking advice regarding inline namespaces
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-11-11 12:26:51
Dear community,
I am seeking advice regarding the usage of inline namespaces for header-only
metaprogramming libraries. I was at Eric Niebler's talk on C++11 library
design back in 2014, and I understand the problem that inline namespaces
solve. I also read all of this past thread [1] on the mailing list, but did
not find
what I was looking for.
I also understand how they can be useful for a normal header-only library
__that would provide guarantees about ABI compatibility__. Indeed, if the
ABI of the library changes from v1 to v2, then any client C1 exposing types
from v1 in its interface and trying to link with a client C2 built against
v2
will get a clean link-time error instead of a runtime error.
Now, my question has several aspects:
(1) How can you guarantee ABI compatibility from one version of a library
to the next? IIUC, ABI can be broken by merely changing the size or
the layout of a type, so guaranteeing backwards ABI compatibility
means freezing those things in time, right?
(2) Assuming that it is unreasonable for a library L to guarantee ABI
compatibility from one version to the next, would there still be a
reason to use inline namespaces to version that library?
(3) When using inline namespaces to version a library (at all, not
necessarily
for header only libraries), are there other guidelines to follow?
For example, I see that Eric Niebler's range-v3 library is all stuffed
in
the range/v3 subdirectory. IIUC, this would allow an eventual range-v4
library to cohabit with the range-v3 library, because people explicitly
state which version of the library they're including. Is this the reason
behind the v3 subdirectory?
Any answer or pointer to answers is appreciated.
Regards,
Louis
-- View this message in context: http://boost.2283326.n4.nabble.com/Seeking-advice-regarding-inline-namespaces-tp4681515.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk