I've an header file with all const values I need within the DLL I'm making, such as:
// myHelpers.hpp
const int kMaxNumVoices = 16;
const int kMaxBeats = 32;
....
and so on. Once I include the .hpp on every .cpp, I can use those constant also on std::array definition.
The problem (theoretically) is that this will violate ODR, since a copy of each var will be used (even if they are const) on each compilation unit, right?
Is this acceptable? Or could deal in some undefined behavior? If its not acceptable, whats the right approch to it?
Aucun commentaire:
Enregistrer un commentaire