Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: longjmp question

Author: Ross Boyd

Date: 16:15:50 06/20/04

Go up one level in this thread


On June 20, 2004 at 12:08:16, Gerd Isenberg wrote:

>On June 20, 2004 at 06:00:58, Ross Boyd wrote:
>
>>My engine (coded in C) uses longjmp() to terminate a search.
>>
>>Is there any disadvantage or hidden overhead in this approach?
>>
>>I notice other engines use a flag which is tested at every node of the search.
>>Surely there's an overhead in doing it that way????
>>
>>I suppose the main drawback of longjmp() is portability. Most languages other
>>than C don't support it.
>>
>>Am I missing something?
>>
>>Ross
>
>Yes, there is a tiny overhead if asking a flag everywhere in the search.
>
>I never used setjmp()/longjmp() so far in C or C++, but C++ try-catch blocks, as
>recently in my recursive De Bruijn generator. You may throw different values for
>different reasons and interprete it inside a catch(int e) or
>catch(ownExceptionType e) block.
>
>Gerd

// snip DeBruijn code

It looks very similar in functionality to longjmp() but much neater. No need to
pass the jump variable around or use a global. I must experiment with it.
Thanks Gerd.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.