Purpose of -fno-objc-exceptions

I’ve found a 2% reduction in the size of my binary from using the -fno-objc-exceptions flag (I already use -fno-objc-arc-exceptions) for most of the files. I thought it might not be able to propagate an exception through methods in files compiled with this flag, but in my testing I found that that was not case. So I’m curious, what’s the tradeoff? Why wouldn’t clang just only enable exceptions for files that used “@try”, “@finally”, “@catch”, or “@throw”?


Leaks and crashes. Even if throwing an exception seems to work, the frames being unwound may have important cleanup actions that are no longer being executed. For example, it's very important to destroy a __weak variable on the stack when unwinding a frame; not doing so is likely to corrupt the Objective-C runtime.

Also, whether unwinding works at all is very target-specific.