• 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: EXC_BAD_ACCESS in a Core Data application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS in a Core Data application


  • Subject: Re: EXC_BAD_ACCESS in a Core Data application
  • From: Rippit the Ogg Frog <email@hidden>
  • Date: Fri, 04 Sep 2009 11:55:42 -0700



Eric Hermanson wrote:
3. Attempting to access or return a local variable that has not been initialized (although you may get a segmentation fault instead of a BAD_ACCESS, I can't remember). For example,

- (BOOL)someMethod
{
    BOOL returnValue;
    // code in the method that never sets the returnValue to anything
    return returnValue;  // this is bad.
}

That's not really the best example. If someMethod returns a BOOL, than no matter what value happens to occupy the memory that returnValue is placed into, it will always be taken as true or false. It might not do the right thing, but won't be likely to cause a crash.


A better example of code that would cause a crash is to return either an uninitialized pointer, or a pointer to a struct that is a local variable.

--
Rippit the Ogg Frog
email@hidden
http://www.oggfrog.com/

_______________________________________________

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: 
 >EXC_BAD_ACCESS in a Core Data application (From: Ian Piper <email@hidden>)
 >Re: EXC_BAD_ACCESS in a Core Data application (From: Eric Hermanson <email@hidden>)

  • Prev by Date: Application main menu title behavior change in 10.6
  • Next by Date: Re: setNeedsDisplayInRect not triggering drawRect?
  • Previous by thread: Re: EXC_BAD_ACCESS in a Core Data application
  • Next by thread: Re: EXC_BAD_ACCESS in a Core Data application
  • Index(es):
    • Date
    • Thread