Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Lesson learned was Never Ignore Endian issues.

This is an excellent lesson for data transport protocols and file formats.

> I had to tweak the network protocols to start packets with a BOM (byte order mark) (as the various switches that sent data didn't define endianess), then swap bytes accordingly.

(A similar thing happened to me with the Python switch from 2 to 3. Strings all became unicode-encoded, and it's too difficult to add the b sigil in front of every string in a large codebase, so I simply ensured that at the very few places that data was transported to or from files, all the strings were properly converted to what the internal process expected.)

But, as many other commenters have rightly noted, big-endian CPUs are going the way of CPUs with 18 bit bytes that use ones-complement arithmetic, so unless you have a real need to run your program on a dinosaur, you can safely forget about CPU endianness issues.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: