[fpc-devel] Improper OUT usage.
Sven Barth
pascaldragon at googlemail.com
Sun Mar 10 22:08:45 CET 2013
On 10.03.2013 20:39, Flávio Etrusco wrote:
> On Sun, Mar 10, 2013 at 11:56 AM, Marco van de Voort <marcov at stack.nl> wrote:
>> In our previous episode, Vincent Snijders said:
>>>> So be careful if you use OUT with types that have range limitations. Not
>>>> setting the out parameter can make debug tools like gttt difficult.
>>>>
>>>
>>> You found a big in fcp-passrc, because if you have an out parameter,
>>> then the callee has to output a valid variable. If it asumes that is
>>> initialized when called, then it must use var instead.
>>
>> I already had changed it to var in r23760. I did want to warn for the
>> bug's pattern, so I wrote this to the ml.
>>
>
> I'd really like the compiler would stop with an error if it can't
> prove a variable/out/result is initialized.
> Did anybody try implementing this in FPC?
Have fun fixing the errors then:
=== example begin ===
type
TTest = record
t: LongInt;
end;
var
t: TTest;
begin
FillChar(t, SizeOf(t), 0);
end;
=== example end ===
The above code will have the hint that "t" is not initalized.
Regards,
Sven
More information about the fpc-devel
mailing list