[DGD] DGD and the static keyword
Troels Therkelsen
troels at 2-10.org
Tue Apr 15 14:45:02 CEST 2003
On Tue, 15 Apr 2003, Felix A. Croes wrote:
> Noah Gibbs <noah_gibbs at yahoo.com> wrote:
>
> > Hi! I just wanted to get a definite opinion on
> > something.
> >
> > DGD doesn't allow the static keyword to be used with
> > local variables, right? A quick trial suggested this
> > was the case.
>
> That is correct.
>
>
> > I don't have any specific need for static locals,
> > I'm just documenting this feature and I want to be
> > sure I'm doing it right.
>
> Supposing that it would be, what do you expect static to mean in that
> context? I'm curious.
As a guess, maybe Noah wanted it to mean the same as it does in C++?
Ie., that it's only initialised the first time it's seen (not applicable
to DGD LPC as it doesn't have initialisors) and if the function is called
again, the variable retains the value it had at the time the last call to
the function finished. In a nutshell a static variable inside a function
in C++ is just a way to create a global variable which has the scope of
being inside a function (so other functions in the same global namespace
can't access it).
[snip]
Regards,
Troels Therkelsen
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list