Date: Wed, 20 Jun 2007 09:07:52 -0400 (EDT) From: Daniel Eischen <deischen@freebsd.org> To: Harti Brandt <harti@freebsd.org> Cc: Stefan Farfeleder <stefan@fafoe.narf.at>, current@freebsd.org Subject: Re: socklen_t (Re: Multicast problems [PATCH]) Message-ID: <Pine.GSO.4.64.0706200905280.4870@sea.ntplx.net> In-Reply-To: <20070620143830.M33081@knop-beagle.kn.op.dlr.de> References: <E1I0E3b-0000kk-Ky@clue.co.za> <46765CB9.9020105@incunabulum.net> <Pine.GSO.4.64.0706180833080.23884@sea.ntplx.net> <4676C30E.7040300@incunabulum.net> <Pine.GSO.4.64.0706181344060.24865@sea.ntplx.net> <4676C952.5000607@incunabulum.net> <4676D168.3050502@incunabulum.net> <4678529A.3080308@incunabulum.net> <Pine.GSO.4.64.0706191823040.1099@sea.ntplx.net> <20070620110702.GB929@lizard.fafoe.narf.at> <Pine.GSO.4.64.0706200824530.4695@sea.ntplx.net> <20070620143830.M33081@knop-beagle.kn.op.dlr.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 20 Jun 2007, Harti Brandt wrote: > On Wed, 20 Jun 2007, Daniel Eischen wrote: > > DE>On Wed, 20 Jun 2007, Stefan Farfeleder wrote: > DE> > DE>> On Tue, Jun 19, 2007 at 06:36:39PM -0400, Daniel Eischen wrote: > DE>> > DE>> > POSIX states that: > DE>> > > DE>> > o The <sys/socket.h> header shall define the type socklen_t, > DE>> > which is an integer type of width of at least 32 bits; see > DE>> > APPLICATION USAGE. > DE>> > > DE>> > and goes on to state: > DE>> > > DE>> > o The <sys/socket.h> header shall define the unsigned integer > DE>> > type sa_family_t. > DE>> > > DE>> > This seems to imply that our socklen_t should not be an unsigned > DE>> > integer (uint32_t), but a signed integer. In APPLICATION USAGE, > DE>> > POSIX states: > DE>> > DE>> I don't understand how you come to that conclusion. Why does not > DE>> mentioning whether socklen_t is signed or unsigned imply it should be > DE>> signed? > DE> > DE>Because it explicitly says unsigned for sa_family_t and does not > DE>say unsigned for socklen_t. To me, "integer" means a C (signed) > DE>integer. The fact that older APIs and implementations used "int" > DE>might support the argument to use int32_t just for compatibility > DE>reasons. As it stands now, portable code has to have some sort > DE>of autoconfig to determine whether or not to use socklen_t or int. > DE>I don't see how you can do this with #ifdefs unless you know > DE>OS version numbers and when socklen_t first got introduced. > > In standardese stating 'integer type' means any integer type. It does not > imply signed or unsignedness. You might look at paragraph 14 of 6.2.5 of > the C standard: "The type char, the signed and unsigned integer types, and > the enumerated types are collectively called integer types." Ok, but it still makes it difficult to write portable code. I do not care so much about this to argue it, so consider the subject dropped :-) -- DE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0706200905280.4870>