Re: Working with curl connections as with sockets.
Date: Tue, 29 Apr 2008 21:35:24 +0400
Tuesday, April 29, 2008, 7:37:59 PM, you wrote:
TA> 'void' is good, agreed.
So, 'void*' for curl_easy_recv(), and 'const void*' for
curl_easy_send(), right? :)
>> 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.
TA> But if that user buffer happens to be a read-only buffer then GCC will generate
TA> "warning: passing argument 1 of 'msend' discards qualifiers from
TA> pointer target type"
Similar warning is issued by compiler from Microsoft Visual Studio
2008: 'function': different 'const' qualifiers.
>> No need to 'fix' what is not broken.
TA> It could be argued that the low-level functions (from Curl_write down)
TA> are currently semi-broken, and pushes the problem upwards. A function
TA> with prototype '<type> * name' tells the user that it must be able to
TA> write to that area which 'name' points to. Which isn't the case, for
TA> the write functions.
I would also add that 'const' modifier allows compiler to employ more
optimizations (at least theoretically so).
Thus, it looks feasible to add 'const' to *_write - functions in some
-- Best regards, Tetetest mailto:tetetest_at_rambler.ruReceived on 2008-04-29