hello,
FPC is very good about issuing hints mentioning the fact that some variable being used may not have been initialized. This can be very useful.
Unfortunately, at this time, there is no way to tell FPC that either, the variable is already initialized or, that it will be initialized by the procedure/function it is being passed to. For instance, consider the code snippet below:
function SomeFunc(parm1 : integer; var parm2 : somerecord) : Boolean;
begin
RtlZeroMemory(@parm2, sizeof(parm2)); // initialize parm2
{ perform binary magic here }
result := everything_is_great;
end;
...
...
...
var
MyParm : somerecord;
begin
{ use SomeFunc }
r := SomeFunc(v, MyParm); { compiler issues a hint that MyParm is not initialized }
end.
It would be very nice to have something along the lines of
that could be placed before SomeFunc's begin statement to inform the compiler that SomeFunc is responsible for initializing parm2. That way, the compiler would not emit superfluous hints about the variable not being initialized every time SomeFunc is used in the program's body.
Thanks for reading.