4 ms·
While the article is rant-y and some details sloppy, I have to admit his core point is pretty good. Rather the writing #ifdef'd code, why not write code that wo
by paulsutter 15y ago
While the article is rant-y and some details sloppy, I have to admit his core point is pretty good. Rather the writing #ifdef'd code, why not write code that works the same regardless of endianness?
That seems like a good idea. Not for -all- the reasons he mentions, but for the simple reason that it's one code path so easier to code and easier to get right.
- alexchamberlain 15y agoStarted a github repo at https://github.com/alexchamberlain/byte-order https://github.com/alexchamberlain/byte-order.
- duaneb 15y agoIf you're using C++, you can dispose of the ifdefs completely and check at compile time the union of a uint16_t and two uint8_ts.
- alexchamberlain 15y agoThe C++ is just an interface... I'm just nice like that!
- deleted 15y ago[deleted]