Question
Should the inline keyword be used for variables in anonymous namespaces in a .cpp file?
If I have a constexpr defined in an anonymous namespace in a .cpp file. Should it be declared as inline? Or not?
What would be the difference between the two declarations?
// In my.cpp
namespace {
constexpr int kVal{4};
// or
inline constexpr int kOtherVal{4};
} // anonymous namespace
// Later a class or function in my.cpp uses the constant
3 119
3