This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: macros to detect endiannes?


Hi Kimmo,

GCC is a very good optimizing compiler.  A very, very good optimizing compiler.

Before you invest in making endian-aware subroutines, I strongly urge you to consider writing endian-agnostic routines.

And if code profiling IN THE OPTIMIZED CODE bears out that those routines need to be & can be made more efficient by being crafted as endian-aware routines, then-and-only-then take the next step by writing non-portable endian-aware code.

Even if the portability is subsumed by macro-triggers of endian-ness to preprocess-in the correct endian-aware code, that code is still less-than-portable.

Also the big-endian and little-endian code needs to be maintained in tandem.  That can be a source of problems, via code rot.

KISS is applicable in situations like these.  Tricky is not necessarily better.  Nor necessarily more efficient.

Sincerely,
--Eljay

More insights at <http://mindprod.com/unmain.html>. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]