cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: newer gcc -> more sample warnings (@Daniel)

From: Guenter <lists_at_gknw.net>
Date: Wed, 04 Jul 2012 14:02:35 +0200

Am 04.07.2012 13:46, schrieb Guenter:
> Hi Daniel,
> I know you want to keep the samples as simple as possible, but I just
> found that with gcc 4.7.0 we get a bunch of warnings like this:
> gcc -I. -I../.. -I../../include -I../../lib -g -O2 -Wall
> -fno-strict-aliasing -DCURL_STATICLIB -c anyauthput.c
> anyauthput.c: In function 'main':
> anyauthput.c:108:12: warning: variable 'res' set but not used
> [-Wunused-but-set-variable]
>
> I think we should add a minimal check there, something like:
> res = curl_easy_perform(curl);
> + /* Check for errors */
> + if(res != CURLE_OK)
> + printf("curl_easy_perform() failed, code = %d\n", res);
>
> do you agree with that?
or, maybe verbose:
+ if(res != CURLE_OK)
+ printf("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));

Gün.

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