Does boost use C++11 "inline namespaces" to avoid ABI incompatibilty errors at runtime?
Asked Answered
O

1

8

C++11 has a feature called "inline namespaces", which allows authors to enforce ABI compatibility at link time without tampering with the API. For instance, these helpful answers from @HowardHinnant explain how libc++ uses inline namespaces:

My question is: Does boost make use of this C++11 feature? It looks like some boost devs were at least thinking of eventually using it at one point. But that thread is pretty old. Did it ever happen? If so, does apply to all boost libraries, or only a subset?

Orton answered 11/8, 2014 at 15:37 Comment(1)
grep "inline namespace" might be useful here.Dynode
T
5

Some libraries have started to use it, but not all. For example this is in Boost.Log:

//! NOTE: I've reformatted this to look cleaner.
#if !defined(BOOST_NO_CXX11_INLINE_NAMESPACES)
    inline namespace BOOST_LOG_VERSION_NAMESPACE {}
    [snip]
#endif
Trivial answered 11/8, 2014 at 18:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.