From: Collin Funk Date: Thu, 12 Jun 2025 00:43:52 GMT Subject: Re: [PATCH v2 2/6] bswap.h: Add support for __BYTE_ORDER__ Message-ID: <87wm9hkcvr.fsf@gmail.com> In-Reply-To: "brian m. carlson" writes: > One additional option you can add if you want (it's completely optional) > is that if `__STDC_VERSION__` is 202311L or larger, then you can > `#include `, which has `__STDC_ENDIAN_LITTLE__`, > `__STDC_ENDIAN_BIG__`, and `__STDC_ENDIAN_NATIVE__`. > > That will work on a modern GCC or clang with an appropriate compiler > flag. I don't know about MSVC, but it might be an option for people who > want to use more esoteric compilers which support standards but aren't > very compatible with GCC and clang. Another standard that is too new to be common, but POSIX.1-2024 added with BYTE_ORDER, LITTLE_ENDIAN, and BIG_ENDIAN [1]. In practice, some systems will have it because glibc had it for a long time. Collin [1] https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html