
This macro (and its friend BOOST_LITTLE_ENDIAN) definition appears in boost/detail/limits.hpp. However, that file is included only if boost/limits.hpp does not detect the standard <limits>. Thus, it does not get defined for more standard compilers.
The serialization library makes use of this macro (in a test), so I wonder how it works on standard compilers.
I could use the ENDIAN macros in some of my code to provide compile time performance options (linux provides something similar). Is it possible to move the ENDIAN macros into some other header so that they are more easily obtained, and also do not force including a limits workaround?
I also imagine if they were actually included in more compilations, that they could get checked for correctness and the maintenance of newer platforms would increase.
I think this one has come up before: in general there is no way tell what the endianness is without doing a runtime test, there's also the problem that there are more than two orderings possible, for example for 4 byte types the byte ordering could be any of: 1 2 3 4 4 3 2 1 2 1 4 3 3 4 1 2 throw in 8 or 16 byte types, plus floating point types, and things get complicated :-( BTW, if you need the endianness in a test, then it is much easier to determine the byte ordering of a type at runtime than at compile time IMO. Sorry to complicate things for you again! John.