[Boost-bugs] [Boost C++ Libraries] #10505: Use gcc/clang built-in endianity macros (too)

Subject: [Boost-bugs] [Boost C++ Libraries] #10505: Use gcc/clang built-in endianity macros (too)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-15 10:11:45


#10505: Use gcc/clang built-in endianity macros (too)
--------------------------------+---------------------
 Reporter: Jan Hudec <bulb@…> | Owner: grafik
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: predef
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
--------------------------------+---------------------
 Endian detection in `boost/predef/other/endian.h` does consider the
 gcc/clang built-in `__BYTE_ORDER__` macros and consequently fails to
 detect endianity of some (usually mobile) platforms.

 E.g. on Android I get `_BYTE_ORDER` defined to `_LITTLE_ENDIAN`, but
 `_LITTLE_ENDIAN` is '''not''' defined, leading to all three conditions
 (`_BYTE_ORDER == _BIG_ENDIAN`, `_BYTE_ORDER == _LITTLE_ENDIAN` and
 `_BYTE_ORDER == _PDP_ENDIAN` being satisfied and yielding conflicting
 definitions.

 The `__BYTE_ORDER__` is provided by gcc and clang compilers themselves and
 therefore should always be there no matter how broken the rest of standard
 library is. What I am not sure is whether they should be used in
 preference to any other method or as a fallback (in which case definedness
 of the `_BIG_ENDIAN`, `_LITTLE_ENDIAN` etc. macros also has to be tested
 before trying to use them)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10505>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC