• 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: Peter Wollschlaeger <email@hidden>
  • Date: Fri, 13 Feb 2004 17:24:08 +0100

const is not necessary because NSString is already unmutable.
Cheers,
Peter

Am 13.02.2004 um 16:57 schrieb Darrin Cardani:

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*'

I guess the compiler's right, but since it requires an NSString instead of an NSMutableString, it shouldn't make any difference, should it? I can cast away the const-ness, but I just want to make sure that's not going to cause any problems. Is it? I have a couple dozen of these warnings. Should I be avoiding using NSStrings as constants, and instead just make them regular globals?

I also get a similar problem when putting these constant strings into NSDictionaries. I get:

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

I just want to make sure whatever I do is safe. Any suggestions would be appreciated.

Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
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.
_______________________________________________
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: is this enough for a singleton? (for a class cluster "placeholder")
  • Next by Date: Re: [Slightly OT] Shareware donation collection
  • Previous by thread: XCode const warnings
  • Next by thread: Re: XCode const warnings
  • Index(es):
    • Date
    • Thread