• 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: [Q] How to detect missing storage allocation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >[Q] How to detect missing storage allocation? (From: "Peter.Teeson" <email@hidden>)

  • Prev by Date: Re: Problem with NSArrayController and passing data to an NSTableColumn
  • Next by Date: Re: drawing pixels
  • Previous by thread: [Q] How to detect missing storage allocation?
  • Next by thread: NSBeginAlertSheet noise
  • Index(es):
    • Date
    • Thread