1. middle-endian/mixed-endian
2. When is htonl(x) != ntohl(x) ?
3. 用一个语句判断大小端
1 int isLittleEndian(void)2 { 3 return *(char *)(int []){ 1} == 1; 4 }
关于Compound Literals,
本文共 474 字,大约阅读时间需要 1 分钟。
1. middle-endian/mixed-endian
2. When is htonl(x) != ntohl(x) ?
3. 用一个语句判断大小端
1 int isLittleEndian(void)2 { 3 return *(char *)(int []){ 1} == 1; 4 }
关于Compound Literals,
转载于:https://www.cnblogs.com/albumcover/p/7121917.html
htonl
andntohl
would not be the same.htonl
would have to rotate left by 8 bits, andntohl
would have to rotate right by 8 bits. –