• 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: Making failed NSAsserts crash an app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making failed NSAsserts crash an app


  • Subject: Re: Making failed NSAsserts crash an app
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 28 Aug 2009 07:23:27 -0700

On Aug 27, 2009, at 10:27 PM, Joar Wingfors <email@hidden> wrote:

Terminology aside, I think that he accurately describes how the Cocoa provided assertion macros are implemented and used in general. These macros allow the developer to describe things that always must be true, and ensures that a failure prevents execution from continuing beyond that point. Used like this, the biggest upshot of turning them off is saving a few CPU cycles, but you will at the same time expose the end user to undefined state and behavior of your application and rob yourself of well defined failure points that assists in troubleshooting.

As I said before, I think that using assertions this way makes you use them less.


If assertions crash your released program, you will only want to assert when you're about to do something bad like corrupt the user's data. If you can accurately predict that, then why bother with the assert at all? But since assertions exist because no programmer is perfect at determining when an error will occur, you'll wind up missing some bad case.

For reference, the UNIX assert() calls abort() at the end.

If you have NDEBUG defined (Traditional UNIX release flag) the assert is a no-op. :)


--Kyle Sluder

_______________________________________________

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


References: 
 >Making failed NSAsserts crash an app (From: Squ Aire <email@hidden>)
 >Re: Making failed NSAsserts crash an app (From: Rob Keniger <email@hidden>)
 >Re: Making failed NSAsserts crash an app (From: Graham Cox <email@hidden>)
 >RE: Making failed NSAsserts crash an app (From: Squ Aire <email@hidden>)
 >Re: Making failed NSAsserts crash an app (From: Kyle Sluder <email@hidden>)
 >Re: Making failed NSAsserts crash an app (From: Ed Wynne <email@hidden>)
 >Re: Making failed NSAsserts crash an app (From: Kyle Sluder <email@hidden>)
 >Re: Making failed NSAsserts crash an app (From: Joar Wingfors <email@hidden>)

  • Prev by Date: Get error message about registered observers when Object receives dealloc message
  • Next by Date: Snow Leopard SDK for non "Premier" or "Select" ADC members
  • Previous by thread: Re: Making failed NSAsserts crash an app
  • Next by thread: Cross-user and cross-process shared settings
  • Index(es):
    • Date
    • Thread