Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NS_HANDLER mystery



> Raising an exception invokes longjmp(), which causes execution to  
> effectively GOTO the evaluation of the if() statement, only this time
>  
> _NSSETJMP() will return a non-zero value, thus causing the else  
> clause of the NS_DURING's if statment to be executed.
> 
> During execution of the else code path, the exception catching scope 
> 
> has already been destroyed.   So, no reason to remove a handler that 
> 
> has already been removed as a part of raising an exception.
> 
> When an exception is raised, the exception handler is consumed  
> because that particular handler can never be used again as there is  
> no way for control flow to return to the NS_DURING/NS_HANDLER code  
> path.  Thus, no need to remove the handler and, as a result, no need 
> 
> to use the NS_*RETURN() functions within the NS_HANDLER/NS_ENDHANDLER
>  
> blocks.

Thanks very much for the reply. Unfortunately, I just realized that my
confusion was a result of my being a dork, not because the code itself
was confusing. I mistakenly thought that NS_VALUERETURN and
NS_VOIDRETURN were for use in a block defined by NS_HANDLER and
NS_ENDHANDLER. If that were the case, then the macros indeed would make
no sense. However, I just reviewed the docs and discovered that
NS_VALUERETURN and NS_VOIDRETURN are meant to be used in a block
defined by NS_DURING and NS_HANDLER, in which case the NS_*RETURN
macros make perfect sense.

Thanks very much for the explanation,
Will
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: NS_HANDLER mystery (From: Bill Bumgarner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.