2 ms·
My C code didn't include mention of ints though, so I'm wondering where you got that from. Your first example is UB and again, is not something my example depe
by tathougies 8y ago
My C code didn't include mention of ints though, so I'm wondering where you got that from.
Your first example is UB and again, is not something my example depended on.
Your final claims are overly cautious. It is perfectly fine to use uint32_t in this way. Uint32_t is defined as a 32-bit unsigned integer. There is a bijection between network order 32-bit unsigned integers and host order integers, and ntohs is the bijection. It is no different than storing any other value. It is certainly not wrong.