ntohq/htonq?

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Sep 14 12:51:32 UTC 2011


In message <306FD881-6140-4DE2-AFF1-95C8079E4187 at xcllnt.net>, Marcel Moolenaar 
writes:

>Is there a reason not to add ntohq and htonq to the short
>and long versions we (and everyone else) already has?
>
>I did some googling and htonq and ntohq seem to be de
>facto names used, but oddly enough no OS has them defined.
>It's surreal. Are there better alternatives we should
>migrate to?

I prefer the explicit encode/decode functions in <sys/endian.h>
because they don't need to be arch specific and they don't make
assumptions about alignment.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list