• 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: What, exactly constitutes a mutable action on an instance?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What, exactly constitutes a mutable action on an instance?


  • Subject: Re: What, exactly constitutes a mutable action on an instance?
  • From: Diederik Meijer | Ten Horses <email@hidden>
  • Date: Wed, 29 May 2013 07:37:47 +0100

May I add two questions to this enlightening thread?

1. With ARC, do we still have to worry about string1 leaking in the following scenario?

@property (nonatomic, copy) NSString *string1;
…..
self.string1 = @"Hello";
string1 = @"Hello hello";
string1 = @"Hello hello hello";


2. How do the strong, copy and weak keywords in the property declaration affect this?

Thanks!

Diederik



Op May 28, 2013, om 10:16 PM heeft Jens Alfke <email@hidden> het volgende geschreven:

>
> On May 28, 2013, at 6:39 AM, Alex Zavatone <email@hidden> wrote:
>
>> NSString *myString;
>
> You’ve declared myString as a _mutable_ pointer to an _immutable_ object. If you had declared it as
>
> 	NSString* const myString = @“Hi";
>
> then the variable itself would be immutable, and the compiler would give you an error if you tried to reassign it. (You often see this style used when declaring a string constant in a header file, since it’s supposed to stay constant and no one should reassign it.)
>
> Working with C++ will beat this concept into your head (for better or worse).
>
> —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


_______________________________________________

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: What, exactly constitutes a mutable action on an instance?
      • From: Quincey Morris <email@hidden>
    • Re: What, exactly constitutes a mutable action on an instance?
      • From: Robert Vojta <email@hidden>
References: 
 >What, exactly constitutes a mutable action on an instance? (From: Alex Zavatone <email@hidden>)
 >Re: What, exactly constitutes a mutable action on an instance? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Core Data never seems to be able to auto-update schema
  • Next by Date: Re: What, exactly constitutes a mutable action on an instance?
  • Previous by thread: Re: What, exactly constitutes a mutable action on an instance?
  • Next by thread: Re: What, exactly constitutes a mutable action on an instance?
  • Index(es):
    • Date
    • Thread