[fpc-devel]zeroing on program startup

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sun Apr 22 23:04:15 CEST 2001


On Fri, 6 Apr 2001, Aleksey V. Vaneev wrote:

> Hello,
>
>   Just wanted to know if there is some
>   FillChar (StaticData, SizeOf (StaticData), 0); in program startup
>   procedure exists... Just wanted to get rid of my own FillChar's and
>   "v:=0, v:=false" type things in unit initializations. BTW, if this
>   "global" FillChar () is implemented then it removes my problems with
>   interdependencies. :)

1) All uninitialized global data is always zeroed out at startup,
   as fas as I know.

2) FPC supports (in Delphi mode) Initialized variables.
   Declare your variables as

Var
  V : Boolean = False;

this way they are initialized correctly at program startup.

If you don't want to use Delphi mode, you can use

Const
  V : Boolean = False;

Which acts as a initialized variable.

Michael.





More information about the fpc-devel mailing list