• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Const qualifier conversion warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Const qualifier conversion warnings (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Xcode 2.1 debugger grief
  • Next by Date: Re: Xcode-users Digest, Vol 2, Issue 249
  • Previous by thread: Re: Const qualifier conversion warnings
  • Next by thread: Re: Const qualifier conversion warnings
  • Index(es):
    • Date
    • Thread