Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: htons, htonl, ntohs, ntohl |
| Date | 2013-08-23 12:27 -0400 |
| Organization | Self |
| Message-ID | <52178D80.5030302@verizon.net> (permalink) |
| References | <kv7jr7$eig$1@dont-email.me> <kv7lfd$m38$1@dont-email.me> <lnr4dke7w7.fsf@nuthaus.mib.org> |
On 08/23/2013 11:36 AM, Keith Thompson wrote: > James Kuyper <jameskuyper@verizon.net> writes: >> On 08/23/2013 08:17 AM, James Harris wrote: >> ... >>> 1. htons doesn't address the issue of communicating with a machine >>> which has a different idea of the size of a short. AIUI a short on >>> one machine might be 16-bit but on another 64-bit. (Hence it's poorly >>> specified.) >> >> POSIX requires that htons be declared as >> uint16_t htons(uint16_t hostshort); >> >> uint16_t is required to have exactly 16 bits, and the size of a short is >> irrelevant. If your system has a declaration that is in terms of short >> int, then it's a different htons(), one that doesn't conform to POSIX, >> at least not to the current version. > > It could conform to POSIX on a system where uint16_t is a typedef for > unsigned short (since typedefs, as you know, don't create new types). You're right, of course. I was thinking mainly in terms of cases like James Harris' hypothetical 64-bit short, for which that would not be possible.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
htons, htonl, ntohs, ntohl "James Harris" <james.harris.1@gmail.com> - 2013-08-23 13:17 +0100
Re: htons, htonl, ntohs, ntohl Siri Cruise <chine.bleu@yahoo.com> - 2013-08-23 05:34 -0700
Re: htons, htonl, ntohs, ntohl James Kuyper <jameskuyper@verizon.net> - 2013-08-23 08:44 -0400
Re: htons, htonl, ntohs, ntohl Keith Thompson <kst-u@mib.org> - 2013-08-23 08:36 -0700
Re: htons, htonl, ntohs, ntohl James Kuyper <jameskuyper@verizon.net> - 2013-08-23 12:27 -0400
Re: htons, htonl, ntohs, ntohl Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-23 09:52 -0600
Re: htons, htonl, ntohs, ntohl glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-23 18:04 +0000
Re: htons, htonl, ntohs, ntohl Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-23 15:24 -0600
Re: htons, htonl, ntohs, ntohl Ian Collins <ian-news@hotmail.com> - 2013-08-24 11:22 +1200
Re: htons, htonl, ntohs, ntohl glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-26 01:55 +0000
Re: htons, htonl, ntohs, ntohl James Kuyper <jameskuyper@verizon.net> - 2013-08-25 22:03 -0400
Re: htons, htonl, ntohs, ntohl Richard Damon <Richard@Damon-Family.org> - 2013-08-25 22:03 -0400
Re: htons, htonl, ntohs, ntohl Ian Collins <ian-news@hotmail.com> - 2013-08-26 14:10 +1200
Re: htons, htonl, ntohs, ntohl "James Harris" <james.harris.1@gmail.com> - 2013-08-23 21:16 +0100
Re: htons, htonl, ntohs, ntohl Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-25 13:54 -0600
Re: htons, htonl, ntohs, ntohl christian.bau@cbau.wanadoo.co.uk - 2013-08-30 10:58 -0700
Re: htons, htonl, ntohs, ntohl Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-30 12:37 -0600
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-31 17:03 +0000
Re: htons, htonl, ntohs, ntohl glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-31 18:13 +0000
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-31 20:52 +0000
Re: htons, htonl, ntohs, ntohl Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-31 14:08 -0600
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-27 13:54 +0000
Re: htons, htonl, ntohs, ntohl Stephen Sprunk <stephen@sprunk.org> - 2013-08-27 10:53 -0500
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-27 22:00 +0000
Re: htons, htonl, ntohs, ntohl "James Harris" <james.harris.1@gmail.com> - 2013-08-27 23:15 +0100
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-28 11:10 +0000
Re: htons, htonl, ntohs, ntohl James Kuyper <jameskuyper@verizon.net> - 2013-08-28 07:20 -0400
Re: htons, htonl, ntohs, ntohl "James Harris" <james.harris.1@gmail.com> - 2013-08-28 12:47 +0100
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-31 16:40 +0000
Re: htons, htonl, ntohs, ntohl "James Harris" <james.harris.1@gmail.com> - 2013-08-27 23:36 +0100
Re: htons, htonl, ntohs, ntohl James Kuyper <jameskuyper@verizon.net> - 2013-08-27 18:54 -0400
Re: htons, htonl, ntohs, ntohl Stephen Sprunk <stephen@sprunk.org> - 2013-08-27 21:02 -0500
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-28 14:10 +0000
Re: htons, htonl, ntohs, ntohl Stephen Sprunk <stephen@sprunk.org> - 2013-08-28 15:06 -0500
Re: htons, htonl, ntohs, ntohl christian.bau@cbau.wanadoo.co.uk - 2013-08-30 10:42 -0700
Re: htons, htonl, ntohs, ntohl Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-31 11:49 +0000
csiph-web