Boost logo

Boost Users :

From: Andrew Dennison (adenniso_at_[hidden])
Date: 2004-11-19 09:52:18


My project hit an interesting snag yesterday. It turns out that in
different areas of the project, one developer had been using the boost
regex library, while the other was using the POSIX library. Since the
boost regex library provides POSIX compatibility with boost/regex.h i
suspect you may already be aware of this, but i'll mention it anyway, as i
believe more could be done about this problem.

regex.h uses #defines for certain numerical constants which are
also declared in boost regex. This is a problem if both posix and boost
are defined in the same project at the same time as the preprocessor will
replace the boost definitions with the macro definition in regex.h (ie
REG_EXTENDED = 1, among others).

I appreciate that this case is somewhat handled by the compatibility
header, but this isn't always an available solution. We were able to
change headers, so this problem was solved, but this may not always be
possible (ie third party software). Perhaps the developers could include
some protection against this kind of error by checking to see if
the offending constants are defined before the boost declarations are
made and #undef-ing them as needed. This kind of error can be difficult
to track down in mid-large projects.

Regards,
Andrew.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net