Robust detection of endianness at compile time.

Ian Lance Taylor iant@google.com
Mon Jul 30 18:06:00 GMT 2007


Andrew Haley <aph-gcc@littlepinkcloud.COM> writes:

> AC_C_BIGENDIAN is for integers.  As far as I am aware the PDP/ARM
> "middle-endian" problem only applies to floating-point words, and the
> situation for those is far more complex than mere endianness.  Not
> every platform supports the IEEE-754 format, and picking apart other
> formats requires special-case programming.  Happily, this isn't a
> problem that most people have to solve.

On the PDP/11 four-byte integers were stored as two 16-bit words in
big-endian order.  Each 16-bit word was stored as two 8-bit bytes in
little-endian order.  The same format was used on the 680x0 versions
of the Alpha Micro.

It is not worth worrying about this format.  If you ever encounter it,
you have much bigger problems to deal with.

See http://en.wikipedia.org/wiki/Middle-endian

Ian



More information about the Gcc-help mailing list