• 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: preventing bad memory access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: preventing bad memory access


  • Subject: Re: preventing bad memory access
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 20 Oct 2011 22:20:28 -0700

On Oct 20, 2011, at 8:56 PM, Don Quixote de la Mancha <email@hidden> wrote:

> For C++, you would need to throw an exception on I/O error, then write
> exception-safe code.  I have not yet really figured out the right way
> to do the equivalent for Objective-C, because Objective-C exceptions
> don't work like C++ exceptions do.

This is what NSError is for. You would return NO (or some other similar value indicating unsuccessful completion) and return an NSError by reference.

FWIW, Objective-C exceptions do behave like C++ exceptions (the exception machinery is the same on modern runtimes), but are not _used_ like C++ exceptions. Throwing an exception from Objective-C code is used to signal programmer error, not general failure to complete an operation.

--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: 
 >preventing bad memory access (From: Wilker <email@hidden>)
 >Re: preventing bad memory access (From: Jens Alfke <email@hidden>)
 >Re: preventing bad memory access (From: Don Quixote de la Mancha <email@hidden>)
 >Re: preventing bad memory access (From: Wilker <email@hidden>)
 >Re: preventing bad memory access (From: Jens Alfke <email@hidden>)
 >Re: preventing bad memory access (From: Don Quixote de la Mancha <email@hidden>)

  • Prev by Date: Re: preventing bad memory access
  • Next by Date: Re: WebView doesn't scroll
  • Previous by thread: Re: preventing bad memory access
  • Next by thread: Re: preventing bad memory access
  • Index(es):
    • Date
    • Thread