Re: [Q] How to detect missing storage allocation?
Re: [Q] How to detect missing storage allocation?
- Subject: Re: [Q] How to detect missing storage allocation?
- From: Alastair Houghton <email@hidden>
- Date: Mon, 22 Mar 2004 09:12:53 +0000
On 21 Mar 2004, at 22:43, Peter.Teeson wrote:
>
In my -init for the Model I had neglected to do theRecords =
>
[[NSMutableArray alloc] init];
>
IOW no storage had been allocated. But the rest of the code was
>
executed.
>
>
So my question is this:
>
>
What could have been done to Alert me to the fact that no storage was
>
allocated?
>
Any way I could have set an exception to help me pinpoint this?
At the top of methods that use theRecords, you could have written
NSAssert(theRecords, @"No storage allocated");
Also, you'll probably spot this mistake more quickly now that you've
made it once :-)
Kind regards,
Alastair.
--
http://www.alastairs-place.net
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.