• 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: Nick Zitzmann <email@hidden>
  • Date: Mon, 19 Mar 2012 09:43:17 -0600

On Mar 19, 2012, at 5:51 AM, Ian Joyner wrote:

> Actually NSArray. Note NSMutableArray inherits from NSArray because it adds extra functionality in methods that can change the object. You can assign an NSMutableArray object to an NSArray reference, thereby making it unchangeable via that path, but you can't assign an NSArray object to an NSMutableArray.

Declaring an NSMutableArray as an NSArray doesn't make it immutable, because you can still send NSMutableArray messages to the array and they'll still work (though the compiler will complain unless you mask them or send the message indirectly). The only way to make a mutable array immutable is to make an immutable copy of the array.

Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________

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

  • Prev by Date: Re: How is this an "incorrect decrement of a reference count"?
  • Next by Date: creating a favorites bar
  • Previous by thread: Re: const correctness
  • Next by thread: Re: const correctness
  • Index(es):
    • Date
    • Thread