>>110What is the best answer? To switch compilers, incurring the kind of nightmare problems you describe above? That's not always even an option. Besides, if you're working with the same chip all the time, endian-awareness is not difficult.
Sometimes it's better to just give up and write the assembly yourself. That at least protects you from awful breakage that can happen even when changing compilation options on the
exact same compiler, or upgrading to a newer version of same. I'm not saying that assembly is
always the best choice but if changing compilers is a more likely event than changing ISAs it has its benefits.
If the unthinkable happens and you
do happen to switch to a different chip later, assembly also has the nice property of making it totally obvious what code was written with ISA specific assumptions in mind. If you have co-workers that apply guards like
#if __LITTLE_ENDIAN__
to 100% of the code they write, I want to know what magical environment you work in because everyone I've ever known will fuck this up if you're aren't testing for bi-endianness.