httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: cvs commit: apache-2.0/src/lib/apr/test testsf.c
Date Sat, 04 Nov 2000 02:03:52 GMT
Greg Stein <gstein@lyra.org> writes:

> On Fri, Nov 03, 2000 at 06:05:11PM -0000, trawick@locus.apache.org wrote:
> > trawick     00/11/03 10:05:10
> > 
> >   Modified:    src/lib/apr/include apr_network_io.h
> >                src/lib/apr/network_io/unix sendrecv.c
> >                src/lib/apr/network_io/win32 sendrecv.c
> >                src/lib/apr/test testsf.c
> >   Log:
> >   Make the len parm to apr_sendfile() apr_ssize_t * instead of apr_size_t *
> >   for consistency with other APR network send/recv calls.
> 
> This isn't right. The apr_ssize_t implies that a negative number can be
> returned. That isn't the case is it? If not, then this should be
> reverted.

Rather than simply revert it, I'd say change everything to apr_size_t
and deal with the consequences.  It doesn't make sense to simply back
this out and be left with the strange inconsistency.

*But first*, why were the other functions apr_ssize_t instead of
apr_size_t?  It seems likely that it was intentional.

I have seen the use of signed integers justified on this mailing list
by the slight speed advantage of signed arithmetic on some (most?) 
hardware.  In some software I was involved in on S/390, somebody
changed a number of unsigned fields to signed fields for a measurable
performance improvement.

> The parameters should follow the semantic model, NOT follow something else
> simply for consistency.

Both have their importance.  As far as following the semantic model
with variables, I've had you tell me to use a signed 32-bit integer
for something that has only two values :)  There are plenty of
examples where signed ints are used in preference to whatever most
closely matches the semantic model.

I doubt that there is any one correct answer here (unless of course on
a 32-bit machine we expect to pass 2+GB pieces of storage to an APR
send/recv function). 

Mostly serious,

Jeff
-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message