|
Boost : |
From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-06-30 14:29:50
John Max Skaller wrote:
> Aleksey Gurtovoy wrote:
> >
> > 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.
>
> So (2) applies.
Yes, I would be happy to use a bool static member constant with in place
initialization here, the only problem is that there are some compilers out
there that do not support this feature, so here the macro.
> > > [And I'd argue the enum is terser anyhow]
> >
> > And I'd argue that enum syntax is ugly ;).
>
> You prefer a MACRO??
I prefer static member constants (where appropriate) :). But as it's not
universally portable yet, I use the macro. At least is says what it does
(BOOST_STATIC_CONSTANT is pretty much self-explanatory, isn't it?), and, in
contrast to enum, it makes possible to automate future transition to actual
constants.
Aleksey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk