Re: Where to find documentation on pre-defined macros

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

 



Brian Dessent wrote:
Lee Rhodes wrote:

  Nonetheless, if I had to write low-level code that depended on ENDIANess,
what is the most robust/platform-independent way to make that determination
(and not pay run-time execution costs)?

Autoconf has the AC_C_BIGENDIAN macro that will determine the
endian-ness of the target at configure time.

And #include <endian.h> defines __BYTE_ORDER, __LITTLE_ENDIAN, and __BIG_ENDIAN which can be tested at compile time.

You can also use htons/ntohs and ntonl/ntohl and they take care of it for you.

David Daney

[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