cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: examples compiler warnings

From: Yang Tse <yangsita_at_gmail.com>
Date: Fri, 23 Sep 2011 13:16:02 +0200

2011/9/23 John P. Hartmann <jphartmann_at_gmail.com>:
> Might you be overlooking that sizeof() is not a constant expression?
>
> You'd have to select the format at runtime?

Yes at runtime.

For these intended to be kept simple to compile/link examples, which
have a single *.c source code file, it could be done for example using
a header file that implemented a function that returns proper size_t
print format and a macro definition which simply called the function.

Later on in source file wanting to use it it, it is just a matter of
including the header file and using the macro as format specifier.

-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-23