dokee's site

Back

Modern C++ Basics - Programming in Mutiple FilesBlur image

inline namespace#

namespace {
namespace impl_v1 {
}
inline namespace impl_v2 {
}
}
cpp

inline#

  • With the rapid development of compiler optimization, compilers today basically don’t care whether you use inline or not.
  • Since C++17, inline variables are introduced.
    • We’ve said that global variables should also split declaration and definition;
    • So inline variables can be directly put into headers, and only needs to be ODR in each TU.
  • However, inline functions / variables may cause double symbols in shared libraries.
Modern C++ Basics - Programming in Mutiple Files
https://astro-pure.js.org/blog/c/modern-c-basics/programming-in-multiple-files
Author dokee
Published at March 6, 2025
Comment seems to stuck. Try to refresh?✨