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

Re: const correctness


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

That makes sense ... although the compiler sure does a good job of catching
it at compile time :)

I was ruminating about it more of a (self) documenting angle as opposed to
runtime enforcement ... and indeed, its application in C++ is what I'm was
thinking of.

Thanks Jens!

-Luther


On Sun, Mar 18, 2012 at 12:41 AM, Jens Alfke <email@hidden> wrote:

>
> On Mar 17, 2012, at 10:12 PM, Luther Baker wrote:
>
> Just curious for the reasoning as to why some of the API calls like
> [NSDictionary valueForKey:] take an NSString* and not a *const* NSString* ?
>
>
> ‘const’ doesn’t mean anything when applied to Objective-C object pointers.
> Unlike C++, the language has no notion of a const versus a non-const
> pointer to an object. (There’d be no way to enforce it anyway, since you
> can send any message to any object.)
>
> —Jens
>
>
_______________________________________________

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>
    • Re: const correctness
      • From: Scott Ribe <email@hidden>
References: 
 >const correctness (From: Luther Baker <email@hidden>)
 >Re: const correctness (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: const correctness
  • Next by Date: Re: How to get Mac codesign certificate?
  • Previous by thread: Re: const correctness
  • Next by thread: Re: const correctness
  • Index(es):
    • Date
    • Thread