[zeromq-dev] Making language bindings work with both maint andmaster
Martin Lucina
mato at kotelna.sk
Mon Oct 4 17:28:47 CEST 2010
mato at kotelna.sk said:
> The only thing I'm not sure of is what is the best kind of version macro(s)
> to define... I'll have a think about it and look at the various options;
> will get back to this tomorrow.
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?
-mato
More information about the zeromq-dev
mailing list