On Oct 20, 2011, at 8:56 PM, Don Quixote de la Mancha <quix...@dulcineatech.com> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com