Is there a way to enforce specific endianness for a C or C++ struct?
问题 I've seen a few questions and answers regarding to the endianness of structs, but they were about detecting the endianness of a system, or converting data between the two different endianness. What I would like to now, however, if there is a way to enforce specific endianness of a given struct . Are there some good compiler directives or other simple solutions besides rewriting the whole thing out of a lot of macros manipulating on bitfields? A general solution would be nice, but I would be