Re: Const qualifier conversion warnings
Re: Const qualifier conversion warnings
- Subject: Re: Const qualifier conversion warnings
- From: Keith Ray <email@hidden>
- Date: Wed, 8 Jun 2005 15:00:15 -0700
On 6/3/05, Theodore H. Smith <email@hidden> wrote:
>
> How do I disable Xcode from telling me about converting to/from
> const? I find this a really time consuming thing to fix, because
> consts generally spread throughout my code. As I make one function
> const, so it requires me to make the functions it calls consts, and
> before long I'm having to totally redesign all of my code for const
> compliance.
to stop the "spread" of const, use const_cast [it's ugly, but it works]
class xxx
{ ...etc....
void bar() {...}; // non-const method
void foo() const
{
xxx* myself = const_cast<xxx*>( this );
myself->bar(); // call non-const methods with no warnings....
};
}
Later, when you have time to make bar() const-correct, you can remove
the const_cast in its callers.
--
C. Keith Ray
<http://homepage.mac.com/keithray/blog/index.html>
<http://homepage.mac.com/keithray/xpminifaq.html>
<http://homepage.mac.com/keithray/resume2.html>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden