cat t.c
#include <stdio.h>
int main() {
unsigned port=10;
printf("%u\n",port);
printf("%u\n",htonl(port));
printf("%u\n",htonl(htonl(port)));
printf("%u\n",htonl(htonl(htonl(port))));
printf("%u\n",htonl(htonl(htonl(htonl(port)))));
}

on x86:
10
167772160
10
167772160
10

on ppc:
10
10
10
10
10

suppose the port number go through N intervening libraries, it will
get flipped N times (suppose they all do htonl), which is not exactly
what is wanted. Also no one can predict how many libraries will
intervene (or get stacked). there does not seem exist a good solution
to this problem...
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to