ccompiler-optimizationlong-integerendiannessmemory-address

C long int always accesses memory as big endian?


In the comment discussion of an old unanswered question, a fellow user is claiming that the C long int type "accesses memory in big endian mode".

I apologize beforehand for my lack of experience, but the statement seems highly suspect. I was not able to find any information corroborating this via a brief Google excursion either.

At most this might be a specific compiler optimization technique, but it seems unlikely that this behavior would be strictly specified in the language design itself.

Please advise.


Solution

  • The discussion you link to is about 64 bit access on a big endian machine - or at least the OP believe they are using a big endian machine. In that context, on a big endian machine (like a Power PC) then yes the long int type will be in the same big endian format as the CPU is expecting, naturally. That is what the comment is saying.