constexpr and endianness

后端 未结 8 530
無奈伤痛
無奈伤痛 2020-12-24 12:42

A common question that comes up from time to time in the world of C++ programming is compile-time determination of endianness. Usually this is done with barely portable #if

8条回答
  •  一向
    一向 (楼主)
    2020-12-24 12:49

    This may seem like cheating, but you can always include endian.h... BYTE_ORDER == BIG_ENDIAN is a valid constexpr...

提交回复
热议问题