[zeromq-dev] Making language bindings work with both maintandmaster
gonzalo diethelm
gdiethelm at dcv.cl
Mon Oct 4 16:34:21 CEST 2010
> With version id it would be the following (major,three digits for
> minor,three digits for patch)
>
> #if ZMQ_VERSION_ID >= 2001001
>
> Where as with ZMQ_MAJOR/MINOR/PATCH it would be:
>
> #if ZMQ_MAJOR > 2 || (ZMQ_MAJOR == 2 && ZMQ_MINOR >= 1 && ZMQ_PATCH >=
1)
>
> I guess this is a matter of taste but I prefer the former one (there
> is no harm in defining both).
After a bit more thinking during the weekend (accompanied by some
drinking as well), I would go for this:
// These are the numbers you have to manually maintain:
#define ZMQ_VERSION_MAJOR 2
#define ZMQ_VERSION_MINOR 0
#define ZMQ_VERSION_PATCH 1
// Everything in a single numeric value, easy for comparison:
#define ZMQ_VERSION_FULL (((ZMQ_VERSION_MAJOR *
100)+ZMQ_VERSION_MINOR)*100+ZMQ_VERSION_PATCH)
// These are for bindings that make this decision at run-time:
int zmq_version_major() { return ZMQ_VERSION_MAJOR; }
int zmq_version_minor() { return ZMQ_VERSION_MINOR; }
int zmq_version_patch() { return ZMQ_VERSION_PATCH; }
int zmq_version_full() { return ZMQ_VERSION_FULL; }
> What would be the benefit of using YYYYMMDD instead of the actual
> version number?
None, that was my brain calling for a break...
--
Gonzalo Diethelm
More information about the zeromq-dev
mailing list