
On Sat, 05 Jul 2008 19:55:13 +0200, Boris <boriss@web.de> wrote:
[...]
Macros as constants are pretty much shunned. Worse, the two options here have different behaviour if they're not on the global namespace. (And also if they are, since the macro prevents all other uses of the name.)
I should have written the code differently:
#if defined(_MSC_VER) # define INVALID_VALUE INVALID_HANDLE_VALUE #else BOOST_STATIC_CONSTANT(handle_type, INVALID_VALUE = -1); #endif
Now it's obvious that the macro is a workaround for VC++ only. While Sebastian's points are valid do they justify to change a class' interface because of a limitation of one compiler? I've no preference (especially as VC++ is not an unimportant compiler of course).
As it turns out we are talking about private members of a class here. Thus I got rid of the static constant and macro and took over the static method from Boost.Process in Subversion (whatever version of Boost.Process that is). Boris