On 25/07/2010, at 6:47 AM, Steve Christensen wrote:

>> I am extracting strings from an NSString and I get NSRange exceptions. I 
>> could always first check to see if the range is valid, but, figured I would 
>> save myself the effort and use the exception handling mechanism.


NO, this is misguided.

Exceptions are meant to indicate a PROGRAMMER error, not a routine runtime 
situation (clue, they are called exceptions, and so indicate truly exceptional 
circumstances, not just an edge case you couldn't be bothered to check for). 
They are expensive, and should not be used for flow control, especially as 
there is a very simple way to avoid them in this case. If you can avoid using 
exceptions, always do so.

--Graham


_______________________________________________

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

Reply via email to