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

const correctness


  • Subject: const correctness
  • From: Luther Baker <email@hidden>
  • Date: Sun, 18 Mar 2012 00:12:36 -0500

Just curious for the reasoning as to why some of the API calls like
[NSDictionary valueForKey:] take an NSString* and not a *const* NSString* ?

I guess NSStrings are immutable and maybe most runtime built strings are
more commonly not const ... but is everyone simply casting these guys at
API invocation or is there a way around this I am missing.

The code just starts to get messy so I find myself removing the 'const' in
my definitions ... but in the spirit of self-describing OO, I sure prefer
to keep them const.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: const correctness
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: There's obviously something I don't understand about autorelease.
  • Next by Date: Re: const correctness
  • Previous by thread: Re: There's obviously something I don't understand about autorelease.
  • Next by thread: Re: const correctness
  • Index(es):
    • Date
    • Thread