• 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: Best practice question [solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best practice question [solved]


  • Subject: Re: Best practice question [solved]
  • From: Boyd Collier <email@hidden>
  • Date: Sun, 29 Oct 2006 12:51:55 -0800

I see that when a document project is created, the boiler plate for MyDocument.m reads

@implementation MyDocument

- (id)init
{
    self = [super init];
    if (self) {

// Add your subclass-specific initialization here.
// If an error occurs here, send a [self release] message and return nil.


    }
    return self;
}


so, unless someone tells me that Apple's got it wrong, that's what I'll go with.


Boyd




On Oct 29, 2006, at 12:12 PM, Boyd Collier wrote:

The many postings on this subject got me looking at some code I wrote a while back, and now I'm wondering whether it is potentially wrong.

Here's the code and a question (as a comment):

- (id)init:(int)vectorLength {
if (nil != (self = [super init])) {
int *theArray = (int*)malloc((size_t)(vectorLength*sizeof(int)));
if (theArray != NULL) {
// do stuff
}
else {
[super dealloc]; // should this be [super release] rather than [super dealloc]?
return nil;
}
}

return self;
}



Thanks, Boyd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Best practice question (From: "Alan Smith" <email@hidden>)
 >Re: Best practice question (From: "Shawn Erickson" <email@hidden>)
 >Re: Best practice question (From: j o a r <email@hidden>)
 >Re: Best practice question (From: Boyd Collier <email@hidden>)

  • Prev by Date: Re: Best practice question
  • Next by Date: Re: Best practice question
  • Previous by thread: Re: Best practice question
  • Next by thread: Re: Best practice question
  • Index(es):
    • Date
    • Thread