On Sun, Mar 10, 2013 at 6:08 PM, Sven Barth <pascaldra...@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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to