throwing an exception in objective-c/cocoa

后端 未结 13 1623
耶瑟儿~
耶瑟儿~ 2020-11-29 15:01

What\'s the best way to throw an exception in objective-c/cocoa?

相关标签:
13条回答
  • 2020-11-29 15:30

    Since ObjC 2.0, Objective-C exceptions are no longer a wrapper for C's setjmp() longjmp(), and are compatible with C++ exception, the @try is "free of charge", but throwing and catching exceptions is way more expensive.

    Anyway, assertions (using NSAssert and NSCAssert macro family) throw NSException, and that sane to use them as Ries states.

    0 讨论(0)
提交回复
热议问题