[fpc-pascal] how to initialize a SearchRec var?
Sven Barth
pascaldragon at googlemail.com
Mon Jan 6 00:26:07 CET 2014
On 05.01.2014 19:24, waldo kitty wrote:
> On 1/2/2014 6:31 PM, waldo kitty wrote:
>> On 1/2/2014 2:52 PM, Sven Barth wrote:
>>> Beginning with 2.7.1 you can use the new Default() intrinsic which
>>> takes a type
>>> name as first and only argument (it returns a 0 initialized value of
>>> that type):
>>
>> 2.7.1 which means that we still have to respond to queries with older
>> versions... ok, i think we can deal with that...
>
>
> following up on this... this is what i came up with... is it right/proper?
>
> {$IF (FPC_FULLVERSION >= 20701)}
> {$INFO initializing dirinfo with Default(SearchRec)}
> dirinfo := default(searchrec);
> {$ELSE}
> {$PUSH}
> {$HINTS OFF}
> {$INFO initializing dirinfo with fillchar(dirinfo,sizeof(dirinfo),$00)}
> fillchar(dirinfo,sizeof(dirinfo),$00);
> {$POP}
> {$ENDIF}
>
>
>
Should be correct.
Regards,
Sven
More information about the fpc-pascal
mailing list