From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-06-27 12:08:37
John Max Skaller wrote:
> I think this macro is useless and should be removed altogether.
> 1. If you're declaring an integral constant, use an enum
> 2. Otherwise make the definition out of class.
Integral constants do not always have integer type; in fact, if you search
for BOOST_STATIC_CONSTANT on boost sources, you'll see that 'bool' is much
more common here. IMO using enum trick to define something that is not an
enumeration type at all is ugly, obscures both the code and the intent, and
also, under some conditions, is error-prone (because, for example, a "bool"
constant can hold any integer value, not only 'true' or 'false'). When I
declare something that has semantics of bool constant (and is a constant), I
want to see 'bool' and 'const' in its declaration, not the 'enum' word
followed by a curly brace. BOOST_STATIC_CONSTANT does not give me exactly
that, but it's close enough, and on conforming compilers it gives the
> The only benefit of inclass static const initialisation
> is syntactic, and that benefit is destroyed by using
> a macro.
Apparently, I don't agree.
> [And I'd argue the enum is terser anyhow]
And I'd argue that enum syntax is ugly ;).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk