Re: Tracking down SIGABRTs
Re: Tracking down SIGABRTs
- Subject: Re: Tracking down SIGABRTs
- From: Sean McBride <email@hidden>
- Date: Mon, 30 Apr 2012 14:47:40 -0400
>> void foo( int *ptr )
>> {
>> assert( NULL != ptr );
>
>Ouch. Don't use this in a Cocoa app; use NSAssert and NSParameterAssert
>instead. You'll get much better reporting of the error, because you can
>use custom messages with parameters, and the app will raise an exception
>and log the backtrace. On Mac OS the system will also put up the
>standard crash alert, whereas a call to abort() (which is what assert()
>calls) just makes the app vanish with no explanation to the user.
Depends on when and why you use asserts. If you use them only to assert impossibilities and programmer errors, I find assert()'s behaviour nice. And you can stub them entirely in release, meaning the user never sees them anyway.
Sean
_______________________________________________
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