[fpc-devel] Improper OUT usage.
Flávio Etrusco
flavio.etrusco at gmail.com
Mon Mar 11 02:30:54 CET 2013
On Sun, Mar 10, 2013 at 6:08 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> On 10.03.2013 20:39, Flávio Etrusco wrote:
>>
>> 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
t.t := 0; // ;-)
This reminds me that a magic compiler procedure to zero-fill records
without the sizeof parameter (and without the hint) has always been on
my wishlist :-) (now I'll have to dig the message where sb explained
why FillChar couldn't be declared with 'out' - IIRC something
regarding interfaces)
Best regards,
Flávio
More information about the fpc-devel
mailing list