2 ms·
For most code it doesn't matter. It matters when you are writing files to be read by something else, or when sending data over a network. So make sure the pla
by bluGill 7mo ago
For most code it doesn't matter. It matters when you are writing files to be read by something else, or when sending data over a network. So make sure the places where those happen are thin shims that are easy to fix if it doesn't work. (that is done write data from everywhere, put a layer in place for this).
- JetSetIlly 7mo agoI agree. Dealing with different endianness has never been an issue so long as you're aware of where the boundaries are. A call to htons() or ntohs() (or the 32bit equivalents) was the solution. I would hope all modern languages have similar helper functions/macros.
- rcxdude 7mo agoIt doesn't really need a shim, if you're parsing incoming data that code should only depend on the endianness of the data, not the endianness of the processor that the code is running on, and in general if you're staying within defined behaviour in C and C++ you're going to need to do this anyway (e.g. https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html https://commandcenter.blogspot.com/2012/04/byte-order-fallac...). If you're concerned about performance optimizers have been able to turn this into the right instructions for decades at this point.