Re: NS_HANDLER mystery
Re: NS_HANDLER mystery
- Subject: Re: NS_HANDLER mystery
- From: Will Mason <email@hidden>
- Date: Sat, 30 Jul 2005 09:18:18 -0700 (PDT)
> 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:
This email sent to email@hidden