cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_global_init and curl_easy_strerror

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 19 Jul 2013 00:02:11 +0200 (CEST)

On Tue, 9 Jul 2013, Török Edwin wrote:

> The docs for curl_global_init say that "If this function returns non-zero,
> something went wrong and you cannot use the other curl functions. ".
>
> I would want to call curl_easy_strerror with the return code from
> curl_global_init, and the current implementation of curl_easy_strerror seems
> safe to call (it doesn't depend on globals), but according to the docs this
> is not guaranteed.

Right. I want to play it safe and easy. I don't want exceptions that we'll
forget in the future and that are very hard to see and figure out.

> Could the docs be updated with a minimal guarantee?

I don't think we gain a lot by adding an exception but we do open up Pandora's
box for future problems like people wanting further exceptions or we figuring
out ways in which we can't promise this.

> "you cannot use the other curl functions, except call curl_easy_strerror
> with the return code from curl_global_init"
>
> Also it is not clear whether curl_version() and curl_version_info() can work
> if curl_global_init failed or not (or if they call curl_global_init
> internally or not, like curl_easy_init).

Which part of "you cannot use the other curl functions" is not clear?

To me, that means NO libcurl function can be used safely if curl_global_init
fails. Sure, some of them may still be functional (for now) but there's no
guarantee they will remain so forever.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-19