[Asterisk-Dev] MP3 library vs. endian.h

Rafal Boni rafal at pobox.com
Wed Jun 11 21:02:56 MST 2003


In message <20030612013101.45895.qmail at web41305.mail.yahoo.com>, you write: 

-> There is a more simple and portable way to do this that
-> works on Solaris/Linux/BSD and I'm sure others.  

I'm well aware of the {h,n}to{n,h}{sl} functions, but those are not
really appropriate here, especially given the fact that I'm not inte-
rested in rewriting the MP3 library but merely making it work on non-
x86 systems; it already has provisions for this, but the right pre-
processor magic wasn't being set up to use them correctly.

[...]
-> Every use of #if doubles your testing requirements as you
-> must test all combinitorial permutations (or else defer to
-> Microsoft's methods: "Why test? They'll buy anything, even if
-> it's broken."

I agree with this in the general case, but like most all things in
software, making firm and unbending rules generally results in worse
transgressions than does using simple common sense... In this case,
fixing the definition of the one endian-dependent union (with the
dreaded #ifdef) is surely less likely to introduce bugs than touching
each place said data is accessed and adding (or forgetting to) the
appropriate byte-swapping macros, especially in code I don't really
know and which looks pretty baroque to me :-)

--rafal




More information about the asterisk-dev mailing list