Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question about static vs global variables

Author: Bruce Moreland

Date: 08:33:19 10/27/01

Go up one level in this thread


On October 27, 2001 at 05:53:59, Frank Phillips wrote:

>Are there any issues associated with time?  Presumably at runtime storage has to
>be created for local variables in a recursive function, such as ABSearch(), and
>then destroyed; whereas it has to be created only at initialisation for globals.
> Having said that, I used to have local arrays for the move list and never
>noticed much if any speed difference (and still use them for testing).
>
>Frank

When a function enters, the stack pointer is adjusted, and the space between
where it is now and where it used to be becomes the space for the local
variables.  When the function exits, the stack pointer is put back to the way it
was.  This overhead can be regarded as trivial.

Recursive functions are no different from any others.

bruce



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.