Chris Frey wrote:
> I think this is a reasonable request.
Easy to request, easy to implement...and a PITA on each release for the
maintainer, whose vote apparently isn't worth much here. :(
I've counted them up, and this will make _seven_ places that have
version numbers: ChangeLog, configure.in, mysql++.spec (2 places),
lib/Makefile.am, lib/Doxyfile, and now lib/mysql++.h. Wanna bet that I
never forget to update one of these before a release?
> #define MYSQLPP_LIB_VERSION 200 // version 2.0.x of the library
If we're going to do this, let's at least use hexadecimal:
#define MYSQLPP_LIB_VERSION 0x020000
1 byte per "part" of the version number.
Why hex? It's a lot easier to parse:
int major = (MYSQLPP_LIB_VERSION & 0xFF0000) >> 16;
int minor = (MYSQLPP_LIB_VERSION & 0xFF00) >> 8;
int bugfix = MYSQLPP_LIB_VERSION & 0xFF;
versus the way the MySQL C API encodes it:
int major = MYSQL_VERSION_ID / 10000;
int minor = (MYSQL_VERSION_ID - (major * 10000)) / 100;
int bugfix = MYSQL_VERSION_ID - (major * 10000) - (minor * 100);
Base 10 is a pain for binary computers.
Also, it's easy to make a macro to make comparisons easier:
#define MYSQLPP_VERSION(major, minor, bugfix) \
((major) << 16) | ((minor) << 8) | (bugfix)
#if MYSQLPP_LIB_VERSION >= MYSQLPP_VERSION(2, 0, 0)
...
As I said, easy to implement. But that's not the problem.