[Lazarus] String vs WideString

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Fri Aug 18 01:12:05 CEST 2017


On 2017-08-17 17:59, Ondrej Pokorny via Lazarus wrote:
>> change my code so I could get rid of the "variable not initialized"
>> whenever you used FillChar().
> And what do you use?


I implemented a FillMem() function that calls FillChar(). The parameter 
are differently defined. Then changed my code as follows:

  var
    msgp: TfpgMessageParams;
  begin
-  fillchar(msgp, sizeof(msgp), 0);
+  FillMem(@msgp, sizeof(msgp), 0);
    msgp.user.Param1 := 2;
    msgp.user.Param2 := x+10;


Finally that warning disappeared.

The FillMem() implementation is as follows:

procedure FillMem(Dest: pointer; Size: longint; Data: Byte);
begin
   FillChar( Dest^, Size, Data );
end;


Regards,
   Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


More information about the Lazarus mailing list