I have this little gem here (idea shamlessly stolen from the C-FAQ):
/* A lot of checks omitted to get rid of the architectures with a "weird" endianness */
/*...*/
#define MP_ENDIANESS ( (0x41424344ul == *(uint32_t*)"ABCD") ? MP_BIG_ENDIAN : MP_LITTLE_ENDIAN )
Is it compliant (that is not an undefined behaviour) to the new current standard (C-18 at the time this question has been asked) and if yes, which of the older ones support it, too?
Is it also standard compliant C++? (Yes, I know about std::endian)