[fpc-devel] RFC: customvariant handling in variants.pp and fmtbcd.pp

Sergei Gorelkin sergei_gorelkin at mail.ru
Fri Apr 15 07:58:57 CEST 2011


15.04.2011 9:20, LacaK пишет:
> Hi Sergei,
>>>
>> Sorry for the delay, got stuck with other issues... Applied in r17319. Thank you for the patch!
> It is ok ;-)
> Thanks.
> Could I ask why is there needed VarDataInit ? (only for my interest ;-))
>
A good question. Formally it is not needed, but in general initializing variables before use remains 
a good idea. Here the TVarData is passed to VarDataCastTo, and after initializing we can be sure 
that VarDataCastTo won't find garbage in remaining 4 bytes of structure if it accesses them for 
whatever reason.

Sergei



More information about the fpc-devel mailing list