[fpc-pascal] Initialization of packed record local variables?

Bo Berglund bo.berglund at gmail.com
Fri Jul 22 12:45:20 CEST 2016


On Fri, 22 Jul 2016 08:12:01 +0200, Bo Berglund
<bo.berglund at gmail.com> wrote:

>>you need to assign it a value, you can assign it default(yourtype)
>>
>
>Is "default" zero?
>i.e.
>
>var
>  HD: TSSReadingHeader;
>  ..
>begin
>  HD := Default(TSSReadingHeader);
>
>And now HD.anything is zero?

I made a test once I got the other issues solved and indeed Default()
on my packed records seems to zero out the memory!
Very good to know! :)

Thanks for pointing it out!

-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list