Re:Ask HN: Favorite pointer tricks in C?
by ay on Sunday November 21, 2010 @10:47AM
(#1927214)
> Casting a u_int32_t over a 4-byte string (like an SMTP verb) to get a value you can switch() on.
How do you ensure your code is portable between the architectures with different endianness ? One trick may be using htonl on the u_int32_t to get it to a canonical format, but probably there would be better approaches ?
How do you ensure your code is portable between the architectures with different endianness ? One trick may be using htonl on the u_int32_t to get it to a canonical format, but probably there would be better approaches ?