I was through a legacy code-base and saw following -- an ugly way to create unique hexa-decimal enums
This work around clutters the build messages, can we achieve similar effect with cleaner syntax without cluttering the build messages.
#include <iostream>
enum t
{
XX = 'AA', // 0x4141 or 0100 0001 0100 0001
};
int main()
{
std::cout<<XX<<std::endl;
char *str = "AA";
std::cout<<*reinterpret_cast<int64_t *>(str) <<std::endl;
}
Aucun commentaire:
Enregistrer un commentaire