× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2010/10/4 10:42 AM, Christen, Duane wrote:
I have done "retry" logic maybe 3 times in the last 10-15 years with
a condition handler. The way I've done it is with the C functions
setJmp, longJmp.

I have had no discernable problems, but if someone sees a flaw in my
logic (below) I would appreciate a heads up.

When initializing the program/procedure
If setJmp(jumpPoint) = 1; // jump to this point, from the condition handler
// after the condition is handled and the exception
// message information is loaded into the error structure.
de-register condition handler
Return;
EndIf;


It seems like it would be safer to code it like this, to make sure you don't handle a return code of say 2 the same as you would handle the zero case:
rc = setJmp(jumpPoint);
if rc = 1;
. . . what you have now
elseif rc <> 0;
. . . unexpected return code
endif;

I haven't thought before about the way the longjmp() jumps into the middle of the statement containing the setjmp(). I don't know what would happen if you coded something like "if setjmp(jumpPoint) = complex_expression", and complex_expression was evaluated by the compiler before the setjmp. I don't know whether the "if" statement would work correctly after the longjmp().

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.