[fpc-pascal] Initializing records and other complicated structures
Sven Barth
pascaldragon at googlemail.com
Mon Sep 27 13:30:16 CEST 2010
Am 27.09.2010 10:38, schrieb Honza:
> 2010/9/27 Jim<hakkie42 at gmail.com>:
>> As TIfdTag seems to contain non-pointer records only, I thought I could
>> use Sizeof and tried this:
>> FillByte(tag, SizeOf(tag), 0); //initialize var.
>> The compiler warning doesn't go away though.
>>
>> Is this the recommended way of doing things?
>
> There is not enough code shown to say much. If the ReadTag procedure
> is declared with a presumably var paramater of type TIfdTag then the
> compiler warning is OK if the passed record has not been initialized
> in any way. In such case it may/should help to change the 'var'
> paramater to an 'out' parameter to explicitly tell the compiler that
> there is nothing going into ReadTag but only the other way.
It's enough code, because FillByte (and others) are defined with a "var"
parameter and such the hint (not a warning) won't go away.
It's an old topic already and we have just to live with it (regarding
the Fill* functions). ^^
Regards,
Sven
More information about the fpc-pascal
mailing list