While looking for a compile-time endian detection macro I found this:
#define IS_LITTLE_ENDIAN (1 == *(unsigned char *)&(const int){1})
According to an answer to C Macro definition to determine big endian or little endian machine?, this can be evaluated at compile-time (at least with GCC) and doesn't assume any memory alignment. Is this really portable (provided C99 is available) and if so what are the caveats of this macro?