Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-09-12 03:06:56


"Jeffrey C. Jacobs" wrote:
>
> Oh! Good point, thanks Daniel! Consider it done:
>
> const volatile Integral &_T
>
> Of course, a const volatile (or volatile const) anything is effectively
> saying: this value doesn't change but assume it changes frequently (don't
> cache it), so although as a completist I will support it, from a language
> POV it's sort of like saying:
>
> Integral & const _T

Of course the & is always fixed, the 'const' and 'volatile' refer to the
type you are refering. Using both 'const' and 'volatile' is AFAIK a
useful thing as it says that *your* code will not change it, but another
thread could (or if it's a hardware register etc.). This prevents the
compiler from optimizing certain things away like moving the 'reading'
of the variable out of a loop or removing code paths that otherwise
would never be taken.

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