[zeromq-dev] Making language bindings work with both maint andmaster

Vitaly Mayatskikh v.mayatskih at gmail.com
Mon Oct 4 17:40:26 CEST 2010


At Mon, 4 Oct 2010 17:28:47 +0200, Martin Lucina wrote:

> Having thought about this a bit more and looked at the various proposals on
> this thread I'd like to propose the following syntax for version macros:
> 
> 1) zmq.h would define ZMQ_VERSION to be some magic (opaque) constant that
> incorporates the major, minor and patch versions; the constants should be
> arithmetically comparable; i.e. something like what Gonzalo proposed.
> 
> 2) it would also define a ZMQ_MAKE_VERSION(major,minor,patch) macro that
> would evaluate to the ZMQ_VERSION constant which the user passed in as
> parameters.
> 
> This would allow for clear code like:
> 
> #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(2,1,0) &&
>     ZMQ_VERSION <  ZMQ_MAKE_VERSION(3,0,0)
> // Something specific to 0MQ versions newer than 2.1.0 but not 3.x.
> #endif
> 
> Comments?

#ifdef ZMQ_VERSION_210
// Something specific to 0MQ versions with API compatible to what 2.1.0 has
#endif

Obviously, 0mq 2.0.x and 3.x won't have ZMQ_VERSION_210 defined, as
well as 2.1.x will miss ZMQ_VERSION_200 and ZMQ_VERSION_300.
-- 
wbr, Vitaly



More information about the zeromq-dev mailing list