sorry to hijack this thread - I had another issue related to htonl or htnos in pcb.h (MQX4)
See the definition here:
#define htonl(p,x) (((uint_8_ptr)(p))[0] = ((x) >> 24) & 0xFF, \
((uint_8_ptr)(p))[1] = ((x) >> 16) & 0xFF, \
((uint_8_ptr)(p))[2] = ((x) >> 8) & 0xFF, \
((uint_8_ptr)(p))[3] = (x) & 0xFF, \
(x))
The problem is the MACRO definition - this is not compliant to other system where on Linux for example below(man htonl) and htnol(&x, x) just did not work - I have to use another variable to save x - {int y = x; htnol(&x, y); }
This looks to me just wrong.
NAME
htonl, htons, ntohl, ntohs - convert values between host and network byte order
SYNOPSIS
#include <arpa/inet.h>
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);