Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-01-09 04:51:42


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). Both have their drawbacks, it seems
we have to choose the petty evil...

> -- Gaby

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk