httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: apr_send using const char instead of void ??
Date Tue, 19 Sep 2000 21:36:54 GMT
Tony Finch <> writes:

> Jeff Trawick <> wrote:
> >Gregory Nicholls <> writes:
> >
> >>     Question: The prototype for function apr_send uses a const char * as it's
> >> buffer parm type. Is there a reason that this isn't a void * ??? I mean I know
> >> can cast it but I'm wondering if there's something I don't understand.
> >
> >"const void *" sounds better to me, too.
> A reason in favour of char* is that length calculations on void
> pointers are forbidden. If the latter were not true I'd be in favour
> of void* too, but then void* would effectively be no different from
> char*.

The current signature places the burden on the caller (forces caller
to cast if not using [const] char * already) but potentially helps the
apr_send() implementation (if we need to do pointer arithmetic).  I'd
rather help the caller in this case.  

In fact, apr_send() doesn't do pointer arithmetic anyway (currently),
so it doesn't help *any* code that apr_send is const char *.  What
we're left with is a restriction on the caller.

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message