I have a dedicated HW register header file, I have created a namespace, like this, which holds all of my HW register addresses:
namespace{
const uint32_t Register1 = (0x00000000);
const uint32_t Register2 = (0x00000004);
const uint32_t Register3 = (0x00000008);
const uint32_t Register4 = (0x0000000c);
}
Is this considered better than using:
static const uint32_t Register1 = (0x00000000);
static const uint32_t Register2 = (0x00000004);
static const uint32_t Register3 = (0x00000008);
static const uint32_t Register4 = (0x0000000c);
I guess the point of namespaces is that we don't pollute the global namespace. Is that right?
I have one .cpp, which uses the header file.