----- Original Message -----
From: "David Abrahams"
"Mike Wilson"
writes: Thanks for that - I'll look into it.
----- Original Message ----- From: "Ryan Barrett"
Newsgroups: gmane.comp.lib.boost.user Sent: Monday, April 21, 2003 10:48 PM Subject: Re: Test for endian using MPL or PP(Wave?) check out boost's template metaprogramming library...i won't guarantee anything, but you might be able to contort it to do what you need.
Don't bother. Endian-ness is fundamentally a property of memory layout. You can't discover anything about the layout of bits in memory at compile-time (and certainly not using the preprocessor), since you can't dereference a pointer at compile-time. The only way to discover endian-ness is to write an integer type to memory and read it back out as a sequence of chars. I thought so, but the doc was informative.
Of course, some platforms supply headers which will tell you about their endian-ness...
I think I saw a BOOST_BIG_ENDIAN_TARGET mentioned in the archives, but no such luck in my 1.29 sources. Thanks.