The Byte Order Fallacy
commandcenter.blogspot.com
The Byte Order Fallacy
1–10 of 61 posts
Re: The Byte Order Fallacy
#2Original thread w/104 comments:
Re: The Byte Order Fallacy
#3"htonl, htons, ntohl, ntohs - convert values between host and network byte order"
The cheapest big-endian modern device is a Raspberry Pi running a NetBSD "eb" release, for those who want to test their code.
Re: The Byte Order Fallacy
#4He even has an example where he just pushes the problem off to someone else "if the people at Adobe wrote proper code to encode and decode their files", yeah hope they weren't ignoring byte order issues.
Re: The Byte Order Fallacy
#5Unless you're dealing with binary data in which case byte order matters very much and if you forget to convert it you're causing a world of pain for someone. He even has an example where he just pushes the problem off to someone else "if the people at Adobe wrote proper code to encode and decode their files" , yeah hope they weren't ignoring byte order issues.
Re: The Byte Order Fallacy
#6Re: The Byte Order Fallacy
#7And do not define any data format to be big endian anymore. Deine it as little endian (do not leave it undefined) and everyone will be happy.
Re: The Byte Order Fallacy
#8TCP/IP is big-endian, which is likely the largest footprint for these concerns. "htonl, htons, ntohl, ntohs - convert values between host and network byte order" The cheapest big-endian modern device is a Raspberry Pi running a NetBSD "eb" release, for those who want to test their code. https://wiki.netbsd.org/ports/evbarm/
Re: The Byte Order Fallacy
#9Re: The Byte Order Fallacy
#10Given a reader (file, network, buffers can all be turned into readers), you can call readInt. It takes the type you want, and the endianess of the encoding. It's easy to write, self documents, and it's highly efficient.