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

Sharing data structures in RAM between 64 bit and 32 bit and 16 bit architectures brings this home painfully. Data communications is equivalently plainful, possibly moreso becaude one has no knowledge of the receiver's architecture. Sending multi-byte values between big- and little-endian machines, for example.

The test could also have included questions on things like packing bools and enums into structures. Again critical to get righht when sharing or transmitting structs, or anything bigger than a char.



Yep, unfortunately a universal 'Network-Byte_order'[1] stil doesn't exist.

Things like this were especially a pain with industrial network protocols that we used in our applications during the transition from PowerPC to Intel on OS X. All the CFSwapInt16HostToBig() and CFSwapInt16BigToHost() stuff...

And earlier before I learned about '#pragma packed' it took me a while to find out where all these extra zeroes suddenly came from :-D

[1] https://en.wikipedia.org/wiki/Endianness#Networking




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

Search: