N
newbarker
Hello,
Very basic question here. If I have the following constants declared
in a.cpp and in b.cpp, would there be any possibility of duplicate
symbols?:
a.cpp
--------
#include <string>
const int TheNumber = 1;
const std::string TheString("Hello");
b.cpp
--------
#include <string>
const int TheNumber = 1;
const std::string TheString("Hello");
Are they not inserted into the symbol table? Previously, I've put
these into an unnamed namespace to be sure but I'm code reviewing
others' code and they're questioning the need for an anonymous
namespace, and I suspect they're correct based on my small test
programs with VC++.
Thanks,
Pete
Very basic question here. If I have the following constants declared
in a.cpp and in b.cpp, would there be any possibility of duplicate
symbols?:
a.cpp
--------
#include <string>
const int TheNumber = 1;
const std::string TheString("Hello");
b.cpp
--------
#include <string>
const int TheNumber = 1;
const std::string TheString("Hello");
Are they not inserted into the symbol table? Previously, I've put
these into an unnamed namespace to be sure but I'm code reviewing
others' code and they're questioning the need for an anonymous
namespace, and I suspect they're correct based on my small test
programs with VC++.
Thanks,
Pete