[fpc-devel] BlockRead() with 'out' parameter instead

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Nov 18 12:13:26 CET 2008


Hi,

Currently I get a lot of the following compiler hints:

     Hint: Local variable "cnt" does not seem to be initialized

This is caused by methods that will set the 'cnt' variable for the
developer.  BlockRead() is one such example. To remove the compiler
hint and to make it clearer to the developer what the method's
parameters are meant for, wouldn't it be better to change the
parameter in question to be a 'out' parameter instead or 'var'?

eg:
  Procedure BlockRead(var f:File; var Buf; count:Int64; var Result:Int64);
  Procedure BlockRead(var f:File; var Buf; count:Longint; var Result:Longint);

would change to...

  Procedure BlockRead(var f:File; var Buf; count:Int64; out Result:Int64);
  Procedure BlockRead(var f:File; var Buf; count:Longint; out Result:Longint);


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list