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

XCode const warnings


  • Subject: XCode const warnings
  • From: Darrin Cardani <email@hidden>
  • Date: Fri, 13 Feb 2004 09:57:20 -0600

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.

  • Follow-Ups:
    • Re: XCode const warnings
      • From: Clark Cox <email@hidden>
    • Re: XCode const warnings
      • From: Jim Correia <email@hidden>
    • Re: XCode const warnings
      • From: Peter Wollschlaeger <email@hidden>
  • Prev by Date: How to draw hairline ?
  • Next by Date: Re: is this enough for a singleton? (for a class cluster "placeholder")
  • Previous by thread: Quartz theory (Re: How to draw hairline ?)
  • Next by thread: Re: XCode const warnings
  • Index(es):
    • Date
    • Thread