mixing preprocessor directives and C constructs ... ick.

Robert P. J. Day rpjday at mindspring.com
Mon Mar 6 14:18:03 UTC 2006


  i'm aware that what follows is technically correct but it creeps me
out just a little.

  in fdisk.c, we see preprocessor directives sneaking into C
conditional constructs:

	sgi_other_endian = (BYTE_ORDER == LITTLE_ENDIAN);

where sgi_other_endian is further incorporated back into the
definitions of a couple of macros in that same file:

	#define SGI_SSWAP16(x) (sgi_other_endian ? __swap16(x) \
                                 : (uint16_t)(x))
	#define SGI_SSWAP32(x) (sgi_other_endian ? __swap32(x) \
                                 : (uint32_t)(x))


i think this whole endianness thing needs rethinking.  or at least a
good scrubbing.

rday





More information about the busybox mailing list