3 ms·
Is that not why functions like htonl exist: to convert between the host architecture's endianness and a platform-independent representation? Your binary isn't
by vitus 4y ago
Is that not why functions like htonl exist: to convert between the host architecture's endianness and a platform-independent representation?
Your binary isn't going to be portable. The only reason your memory layout should be is if you intend to serialize it. But if you're going that extra step, you _need_ to convert it to a platform-independent format regardless -- otherwise, not even your ints deserialize correctly.