How can I use a preprocessor #if expression to tell if a machine is big-endian or little-endian?
You probably can’t. (Preprocessor arithmetic uses only long ints, and there is no concept of addressing.) Are you sure you need to know the machine’s endianness explicitly? Usually it’s better to write code which doesn’t care. 6.7: I’ve got this tricky processing I want to do at compile time and I can’t figure out a way to get cpp to do it. A: cpp is not intended as a general-purpose preprocessor. Rather than forcing it to do something inappropriate, consider writing your own little special-purpose preprocessing tool, instead. You can easily get a utility like make(1) to run it for you automatically. If you are trying to preprocess something other than C, consider using a general-purpose preprocessor (such as m4).