[interfacekit] Re: A little help...
- From: "Marcus Overhagen" <ml@xxxxxxxxxxxx>
- To: interfacekit@xxxxxxxxxxxxx
- Date: Wed, 12 Mar 2003 02:43:31 GMT
Adi Oanca:
> How do I get rid of this error message:
> src/kits/interface/Window.cpp: In method `bool BWindow::NeedsUpdate()
> const':
> src/kits/interface/Window.cpp:1126: passing `const BLooper' as `this'
> argument of `bool BLooper::Lock()' discards qualifiers
> src/kits/interface/Window.cpp:1128: passing `const BWindow' as `this'
> argument of `void BLooper::Unlock()' discards qualifiers
You can't call non-const functions from a const function.
Declaring it const promises to the compiler that you don't
modify any data. There is one exception, you can modify
variables that have been declared as mutable.
> bool BWindow::NeedsUpdate() const{
Obviously, you can't remove the const here.
> Lock();
> serverLink->FlushWithReply( &replyData );
> Unlock();
If you really need to lock here, you need to cheat
and use a const=5Fcast as Ingo suggested.
Or you directly do whatever lock does, and make sure
that the variable that is modified is mutable.
Marcus
- References:
- [interfacekit] A little help...
- From: Adi Oanca
Other related posts:
- » [interfacekit] A little help...
- » [interfacekit] Re: A little help...
- » [interfacekit] Re: A little help...
- [interfacekit] A little help...
- From: Adi Oanca