RE: macros to detect endiannes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kimmo Fredriksson wrote:

> Are there any predefined macros that could be used to detect the
> endiannes at compile time, that I could use in conditional
> compilation?

No, not by default. If your project uses autoconf you can use macro
AC_C_BIGENDIAN to create a define in the generated config.h; see the manual
and the 'autobook':

    http://www.gnu.org/manual/autoconf/autoconf.html
    http://sources.redhat.com/autobook/

If you're compiling for a large set of platforms you should really consider
autoconf etc.; if you're only compiling for a small set you can test for
platform specific defines (e.g. _WIN32 and _M_IX86 or __sun__) and then make
your own defines and #error if nothing matches.

Rup.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux