• 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: Objective-C Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C Question


  • Subject: Re: Objective-C Question
  • From: Dave <email@hidden>
  • Date: Mon, 11 Mar 2013 20:45:01 +0000


On 11 Mar 2013, at 20:30, Seth Willits wrote:

On Mar 11, 2013, at 1:21 PM, Dave wrote:

+(NSMutableDictionary*) newDict
{
return [[NSMutableDictionary alloc] init];
}

(I hope you're using ARC otherwise this is a memory leak.)


Yes, but it's only an example so don't worry about that, and, anyway, it isn't necessarily a leak, it will only leak if no one releases it in Non-Arc and since the method is named correctly, it will cause an analyzer warning if it is not released.


myDict = [[super class] newDict];

This should be [super newDict].

-- Seth


Surely that would call the Instance Method (and there isn't one), I think the correct code is:

[[self superclass] newDict];

as someone else all ready said.

Cheers
Dave




_______________________________________________

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: Objective-C Question
      • From: Lee Ann Rucker <email@hidden>
    • Re: Objective-C Question
      • From: John McCall <email@hidden>
References: 
 >Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Objective-C Question
  • Next by Date: Re: Objective-C Question
  • Previous by thread: Re: Objective-C Question
  • Next by thread: Re: Objective-C Question
  • Index(es):
    • Date
    • Thread