cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: examples compiler warnings

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 22 Sep 2011 22:04:34 +0200 (CEST)

On Thu, 22 Sep 2011, John P. Hartmann wrote:

> My apologies. %zd is a GNU extension to POSIX.
>
> There is no posix solution to the quagmire of size_t (and ssize_t).
>
> The pragmatic solution is to use long and %ld instead.

Right, although that too can introduce warnings or more or less ugly typecasts
like on win64 where size_t is 64 bit but long 32 bit.

There's just no easy and good-looking way to do this. Internally in libcurl
we've solved this by having our own portable *printf() but in the examples we
better not do it that way...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-22