Home > Blogs > Cocoa Tip of the Day, 1/28/10

Cocoa Tip of the Day, 1/28/10

Unlike Java, exceptions in Objective-C have no overhead when they are not thrown but a lot of overhead when they are.  Throwing an exception requires several function calls for every stack frame between where it is thrown and where it is caught.  Only use exceptions in places where they are likely to be uncommon.

For more tips, and more detail about this tip, please see my new book,
Cocoa Programming Developer's Handbook,
available in print and electronic formats.

Become an InformIT Member

Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.