curl-library
Re: wishlist: curl_easy_setopt(3): add better bad input warning?
Date: Wed, 05 Mar 2008 13:21:16 +0100
Daniel Stenberg wrote:
> On Mon, 3 Mar 2008, Andreas Mohr wrote:
>> doing something as simple as
>>
>> VERIFY(curl_easy_setopt(curl_handle, CURLOPT_VERBOSE) == CURLE_OK)
>>
>> can have dire consequences since it is missing the additional parameter
>> (boolean, verbosity on/off) that seems to be required for all
>> curl_easy_setopt() invocations. This results in loud complaints by Valgrind
>> (stack trashing etc.).
>
> Funny that you should bring this up right now, with Michal Marek's work on a
> typechecker macro in progress: http://curl.haxx.se/mail/lib-2008-02/0292.html
Actually, protection against this kind of error can be easily done using
standard C preprocessor:
#define curl_easy_setopt(handle, option, value) \
curl_easy_setopt(handle, option, value)
Maybe we could add this minimum protection for compilers where the
typechecker doesn't work (it's a newest-gcc-only thing and doesn't yet
work for C++).
Michal
Received on 2008-03-05