
From: Edward Diener <eddielee@tropicsoft.com>
David Abrahams wrote:
Edward Diener <eddielee@tropicsoft.com> writes:
BOOST_COMPILER_VC == BOOST_COMPILER_VC71_VERSION
is more expressive than
BOOST_MSVC_VERSION == 070100
It is more expressive than some long number because the former encompasses the idea of a version of Microsoft VC++. I am trying to create a set of macros which
Not at all. That the comparison is against BOOST_MSVC_VERSION makes quite clear the purpose of the expression. Then, were it a proper value, "070100" would clearly indicate a check for v7.1SP0. What's not expressive about that? IOW, "070100" is far clearer than "BOOST_COMPILER_VC71_VERSION."
equate to version numbers of compiler releases but which also allow boolean comparisons for that release. That is why I have BOOST_COMPILER_XXX_VERSION and BOOST_COMPILER_XXX_VERSION_HIGH for the former and BOOST_COMPILER_XXX, BOOST_COMPILER_XXX_OR_HIGHER, and BOOST_COMPILER_XXX_OR_LOWER for the latter.
With numbers, you get all of that for free and there aren't any ugly names!
Nor do I think
BOOST_COMPILER_VC <= BOOST_COMPILER_VC71_VERSION_HIGH
is an improvement over
BOOST_MSVC_VERSION < 070200
I am sorry I can not make you see that and you still want programmers to refer to version numbers as numbers.
I'm sorry we haven't gotten you to see the value of standardized numbers.
Let us suppose that one has workaround code only for BCB6. Currently, because BCB6 encompasses definitions of __BORLANDC__ between 0x560 and 0x564, using BOOST_WORKAROUND one would have to write to be completely correct:
#if BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, <= 0x564) // code #endif
No! The point is that one would use a standardized macro like BOOST_BCB_VERSION, not __BORLANDC__. Furthermore, the comparison would be >= 050600 and < 050700 (or, with the idea from another branch of this thread, >= BOOST_VERSION(5,6,0) and < BOOST_VERSION(5,7,0)). That's flexible, standardized, and clear!
whereas with my macros one would write:
#if BOOST_WORKAROUND(BOOST_COMPILER_BORLAND,BOOST_COMPILER_BCB6_VERSION) && BOOST_WORKAROUND(BOOST_COMPILER_BORLAND,BOOST_COMPILER_BCB6_VERSION_HIGH)
That's incomprehensible.
or even the much more succinct
#if BOOST_COMPILER_BCB6 // code #endif
Granted that BOOST_WORKAROUND is more flexible than what I have presented, given the practical case above, which I think is very prevalent in Boost code, which do you really see as more understandable and easier to write ? My point is that
Your last solution only works if one wants to create and maintain an ever increasing set of named/versioned macros. Given that the conditional compilation being controlled isn't, in general so neat as to apply to all patch levels of a single major version of a compiler, your solution breaks down. The alternative is comprehensible and provides the ability to express every necessary combination. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;