curl-library
version number helper macros?
Date: Thu, 14 May 2015 23:37:18 +0200 (CEST)
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.htmlReceived on 2015-05-14