• 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: Tracking down SIGABRTs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tracking down SIGABRTs


  • Subject: Re: Tracking down SIGABRTs
  • From: Greg Parker <email@hidden>
  • Date: Mon, 30 Apr 2012 11:55:59 -0700

On Apr 30, 2012, at 11:00 AM, Jens Alfke <email@hidden> wrote:
> On Apr 29, 2012, at 8:00 PM, Don Quixote de la Mancha wrote:
>> Place some assertions as the very first executable lines in each of
>> your subroutines.
> ...
>> #include <assert.h>
>>
>> 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.

assert() and abort() also log the backtrace and present the standard crash alert to the user.


--
Greg Parker     email@hidden     Runtime Wrangler



_______________________________________________

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: 
 >Tracking down SIGABRTs (From: Alex Zavatone <email@hidden>)
 >Re: Tracking down SIGABRTs (From: Don Quixote de la Mancha <email@hidden>)

  • Prev by Date: Re: Tracking down SIGABRTs
  • Next by Date: Re: Tracking down SIGABRTs
  • Previous by thread: Re: Tracking down SIGABRTs
  • Next by thread: Re: Tracking down SIGABRTs
  • Index(es):
    • Date
    • Thread