curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

curl_easy_setopt type checking for C++

From: Jeff Mears via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 9 Dec 2019 21:37:03 +0000

curl_easy_setopt and curl_multi_setopt don't currently have a C++ implementation that enforces type checking. In C, it uses GCC extensions to do this type checking.

In C++, there are many ways to accomplish this type checking, and I was wondering what libcurl devs would actually want.

As an example, the following:

    curl_easy_setopt(easy, CURLOPT_NOSIGNAL, 1);

In C, this is broken. 1 is an "int", but the parameter is defined as "long". The typecheck-gcc.h stuff would detect this and throw an error.

In C++, there are essentially two ways to do this. Should it cause a compiler error, or automatically allow this to work properly by converting to long first?

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-12-09