cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Working with curl connections as with sockets.

From: Tor Arntsen <tor_at_spacetec.no>
Date: Tue, 29 Apr 2008 17:37:59 +0200

On Tue, Apr 29, 2008 at 5:08 PM, Yang Tse <yangsita_at_gmail.com> wrote:

> Even better just use "void *mem" for the second argument. The benefits
> for this are:

'void' is good, agreed.

> No const poisoning all over the place, and respective compiler warnings.
> Not introduction of signed vs unsigned char issues, and respective
> compiler warnings.
> Not force the user buffer to be sent to be of any particular type, its
> just a chunk of memory and it can very well be dereferenced with a
> void pointer.

But if that user buffer happens to be a read-only buffer then GCC will generate
"warning: passing argument 1 of 'msend' discards qualifiers from
pointer target type"

> No need to 'fix' what is not broken.

It could be argued that the low-level functions (from Curl_write down)
are currently semi-broken, and pushes the problem upwards. A function
with prototype '<type> * name' tells the user that it must be able to
write to that area which 'name' points to. Which isn't the case, for
the write functions.

-Tor
Received on 2008-04-29