[fpc-pascal] Static local variables available?
pascaldragon at googlemail.com
Thu Jul 20 15:50:25 CEST 2017
Am 20.07.2017 13:01 schrieb "Bo Berglund" <bo.berglund at gmail.com>:
> On Thu, 20 Jul 2017 11:11:50 +0200, Maciej Izak
> <hnb.code at gmail.com> wrote:
> >2017-07-20 11:03 GMT+02:00 Bo Berglund <bo.berglund at gmail.com>:
> >> So since I don't really want to use a global, is it possible to
> >> declare a local variable static in the sense that it retains its
> >> values across calls to the procedure?
> >> If so how is it done?
> >procedure foo;
> > s : string ='';
> but it looks a bit involved, probably better to use an object field
> variable instead only accessible from the internal methods.
If you don't want to use $push/$pop then you can also simply enable $J+ for
the whole unit. But this will also mean that global constants are writable.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal