|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-09 05:09:16
>From: "Daniel Frey" <daniel.frey_at_[hidden]>
> Gabriel Dos Reis wrote:
> >
> > I'm not one the authors of the book mentioned but I will say what I
> > know (from experience both as a user and casual implementor). The
> > issue of enum/static const is an endless debate. However, one thing is
> > sure: Even with the amended paragraph in the Standard (redefinition of
> > "used"), passing an lvalue to a function that expects a const
> > reference more or less takes the referenced entity's address, and as
> > such makes the "static const object" used, therefore a definition is
> > required. One looses the "purely compile-time constant" aspect.
>
> This matches my experience (as a user only :)
>
> > Yes, a smarter compiler may do better, but such smarter compilers are
> > quite rare :-)
> > Yes, the thingy ends up in the link map (as a local symbol).
>
> Just to make sure: Do you "vote" in favor of enums? I have seen problems
> with 'static const ...', but I have never seen problems with enums
> (although they theoretically exist).
Not just theoretically. As mentioned in an earlier posting in this thread,
BCC doesn't work well with enums, but it does work with static const. Also,
there's the issues pointed out by Paul Mensonides, due to the fact that
enums are UDTs.
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk