• 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: Memory leak if alloc succeeds but init fails?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leak if alloc succeeds but init fails?


  • Subject: Re: Memory leak if alloc succeeds but init fails?
  • From: Wincent Colaiuta <email@hidden>
  • Date: Mon, 1 Oct 2007 16:23:20 +0200

El 1/10/2007, a las 1:36, Jeff Laing escribió:

Exceptions should really only be used to signal programmer errors;
that is failed assumptions (things you assume to be true).

So I would say, return nil if the failure to initialize is caused by
an external factor outside of your control, and raise an
exception if your assumptions about what state should be true have not been met.

This is a subjective assessment, easily contradicted. I think the failure
of alloc to return me any memory would be 'an external factor outside of my
control', but would not have expected it to happen. Its definitely
something that I cannot 'pre-check'.

I totally agree with you. The success or otherwise of a memory allocation is something outside of your control, something whose success you should not "assume" and you should therefore check the result. I never said otherwise.


Cheers,
Wincent



_______________________________________________

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: Memory leak if alloc succeeds but init fails?
      • From: "Jeremy Hughes" <email@hidden>
  • Prev by Date: Re: Snippets repository
  • Next by Date: Re: Memory leak if alloc succeeds but init fails?
  • Previous by thread: Re: Snippets repository
  • Next by thread: Re: Memory leak if alloc succeeds but init fails?
  • Index(es):
    • Date
    • Thread