Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I use a preprocessor #if expression to tell if a machine is big-endian or little-endian?

0
Posted

How can I use a preprocessor #if expression to tell if a machine is big-endian or little-endian?

0

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).

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123