|
|
|
|
|
by LukeShu
2791 days ago
|
|
Rob Pike is saying that your code should never care/check what the host byte order is; if you use the libc FOOtoh() functions, you aren't caring what the host byte order is, you're just converting something to it. Put another way, Pike is saying that libc should have implemented be16toh() like: # define be16toh(x) ( (((char*)x)[1]<<0) | (((char*)x)[0]<<8) )
instead of how GNU libc implemented it: # if __BYTE_ORDER == __LITTLE_ENDIAN
# define be16toh(x) __bswap_16 (x)
# else
# define be16toh(x) __uint16_identity (x)
# endif
But that complaint doesn't affect programs that call be16toh(). |
|