Determining endianness at compile time [duplicate]
To answer the original question of a compile-time check, there’s no standardized way to do it that will work across all existing and all future compilers, because none of the existing C, C++, and POSIX standards define macros for detecting endianness. But, if you’re willing to limit yourself to some known set of compilers, you … Read more