I'm using C++11 on a project of mine and was wondering how best to represent the ELF magic number. I'm not a fan of hex literals, so I was looking for something better than:
const uint32 ELF_MAGIC_NUMBER = 0x7F454c46; // 0x7F, E, L, F
So, I tried to write:
const uint32 ELF_MAGIC_NUMBER = { 0x7F, 'E', 'L', 'F' };
but the compiler complains that there are too many items in the initializer list, which is understandable, although annoying.
Is there any way to write an integer literal in terms of its bytes? I feel like the first option, while it works, is not as readable at the second.