• 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: XCode const warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode const warnings


  • Subject: Re: XCode const warnings
  • From: Jim Correia <email@hidden>
  • Date: Fri, 13 Feb 2004 11:32:51 -0500

On Feb 13, 2004, at 10:57 AM, Darrin Cardani wrote:

I have a project I've been building with Project Builder. I recently moved the project to XCode and am now getting some warnings I wasn't getting with PB. For example, I'm calling NSMutableString's replaceOccurrencesOfString:withString:options:range method. The "withString" parameter I'm passing is declared as:

const NSString* myString = @"blah";

So I'm getting the warning:

invalid conversion from `const NSString*' to `NSString*'

NSString is already immutable, so you don't gain anything from making it a const pointer.

What you might want to do is make sure that no one reassigns myString to something else, so you'd write

NSString * const myString = @"blah";

Jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >XCode const warnings (From: Darrin Cardani <email@hidden>)

  • Prev by Date: Re: [Slightly OT] Shareware donation collection
  • Next by Date: Re: XCode const warnings
  • Previous by thread: Re: XCode const warnings
  • Next by thread: Re: XCode const warnings
  • Index(es):
    • Date
    • Thread