In the intent to swiftly assigning a Value to an Array I tried to use the
FillDWord() Function.
When I initialize it with
FillByte() it is correctly initialized. But when I want to assign the actual Value with
FillDWord() it produces an unrecoverable Crash.
To demonstrate this Behaviour I extended the
Example104 from the Official Documentation at:
FillDWord() DocumentationProgram demofilldword;
uses
SysUtils;
{ Program to demonstrate the FillDWord function. }
Const
ArraySize = 256;
Var
S : Array [0..ArraySize - 1] of Int64;
v: Cardinal;
I : longint;
begin
v := 7;
S[0] := 0;
try
WriteLn('Array S - FillByte(): do ...');
FillByte(S,SizeOf(S),0);
For I:=1 to ArraySize - 1 do
If S[i]<>0 then
WriteLn('Position ',i,' not zeroed out');
WriteLn('Array S : Init done.');
WriteLn('Array S - FillDWord(): do ...');
FillDWord(S,SizeOf(S),v);
WriteLn('Array S - FillDWord(): Execution done.');
For I:=1 to ArraySize do
WriteLn('Position ',i,' has the value: '#39, S[I], #39);
WriteLn('Array S - FillDWord(): Check done.');
except
on e: Exception do WriteLn('Exception [', e.HelpContext, ']: '#39, e.Message, #39);
end;
WriteLn('Demo App done.');
end.
This little Prototype produces this Output:
$ ./demofilldword
Array S - FillByte(): do ...
Array S : Init done.
Array S - FillDWord(): do ...
Segmentation fault (core dumped)
(I don't know where the Core Dump is written to but I can't find it)
The actual Value in this Use Case in
v is actually "7" so I could use
FillByte(), too, but that wouldn't cover other Use Cases for Values > 255 .
Please, can anyone give Insight about this Behaviour ?