--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> > If I need something like pi as a const I would declare a class member
> const for pi, not a function scoped const var.
>  
> If you needed to use this constant in only one method, declaring it as a
> class member would be a tiny bit wasteful, as it would always sit there
> taking up memory, whereas a local const wouldn't.

Well, in this particular case I would declare pi as a *static* const
class member: this way I think its memory should be allocated a single
time (for the class definition, being static) insted of being
allocated for every class istance (non-static class members) or every
time the member function is executed (function scoped vars and
consts).. unless their initial value is unknown at compile-time, I
think consts should always be defined as static.

Cosma

Reply via email to