Looks good but it is a little funky to add macros for testing versions
in a later version. Wouldn't one have to wrap the version test in an
ifdef for this macro now? :-)

In general I think it's a nice concept though.

Anders

On Thu, May 14, 2015 at 2:37 PM, Daniel Stenberg <[email protected]> wrote:
> Hi!
>
> I just answered to this stackoverflow question "How to get and compare
> libcurl version?"[1] and Rich Moore helped me over IRC to realize that users
> would perhaps enjoy a slightly easier way to do that sort of version checks.
>
> So, What would you say about adding these two?
>
> #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
>
> #define CURL_AT_LEAST_VERSION(x,y,z) \
>   (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
>
> It would make it possible to check version at run-time like this:
>
>   curl_version_info_data *d = curl_version_info(CURLVERSION_NOW);
>
>   if(d->version_num >= CURL_VERSION_BITS(7,33,0) ) {
>     /* this is libcurl 7.33.0 or later */
>     printf("Succcess\n");
>   }
>
> ... and for build-time checks like this:
>
>   #if CURL_AT_LEAST_VERSION(7,33,0)
>   /* this is 7.33.0 or later */
>   #endif
>
> Thoughts? Better ideas?
>
>
> [1] =
> http://stackoverflow.com/questions/30233344/how-to-get-and-compare-libcurl-version
>
>
> --
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  http://curl.haxx.se/mail/etiquette.html



-- 
Anders Bakken - Netflix
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to