On Thu, Oct 17, 2013 at 05:29:33PM +0200, berenger.mo...@neutralite.org wrote: > Speaking about endianness, it really is hard to manage: > > void myfunction( ... ) > { > #ifdef BIG_ENDIAN > move_bytes_in_a_specific_order > #else > move_bytes_in_the_other_specific_order > #endif > }
Bad way to manage endian in C. Better to have branching based on C itself (rather than preprocessor), otherwise you run the risk of never testing code outside the branch your dev machine(s) match. E.g. use char is_little_endian( … ) { int i = 1; int *p = &i; return 1 == *(char*)p; } Or similar. The test will likely be compiled out as a no-op anyway with decent compilers (GCC: yes; Sun Workshop: no.) -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20131017161703.gc11...@bryant.redmars.org