Re: Making failed NSAsserts crash an app
Re: Making failed NSAsserts crash an app
- Subject: Re: Making failed NSAsserts crash an app
- From: Kyle Sluder <email@hidden>
- Date: Thu, 27 Aug 2009 13:23:08 -0700
On Thu, Aug 27, 2009 at 12:29 PM, Ed Wynne<email@hidden> wrote:
> This attitude is, at best, a perversion of the very definition of an
> assertion. Assertions are things that must be true, that is why they are
> assertions. They do not, check that, should not become less true just
> because your app is built release vs debug.
Strictly speaking I believe you're more accurately describing an
invariant than an assertion.
> If you are using assertions to test for things that are handleable
> situations or recoverable errors, you are doing it wrong. Checking is good,
> but its just that, checking... not asserting.
There's a difference between a condition that will cause your app to
crash and a condition that will cause your app to perform extra
work/graphics glitch/other easily fixed state. Obviously these latter
cases are not desirable, but they're not crashers.
Not all error states are fatal states. Assert happens when entering
an error state, and is left out of release. abort() happens when
entering a fatal state, and is kept in release (hopefully to never be
executed).
(Just for the record, these opinions are mine and do not necessarily
reflect those of my employer. If you want to see how we use OBASSERT
and friends, grab the OmniSource frameworks and look at the code.)
--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