Re: [fpc-pascal] how to initialize a SearchRec var?

2014-01-05 Thread waldo kitty
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

[fpc-pascal] Checking assignment compatibility

2014-01-05 Thread Mark Morgan Lloyd
Simulating a C-style conditional, I can do this function tf(const q: qword; const qt, qf: TObject): TObject; inline; begin Assert(TypeOf(qt) = TypeOf(result)); which- as I understand it- checks that the types are strictly the same. How do I relax this to only ensure that the parameter is

Re: [fpc-pascal] how to initialize a SearchRec var?

2014-01-05 Thread Sven Barth
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

Re: [fpc-pascal] how to initialize a SearchRec var?

2014-01-05 Thread waldo kitty
On 1/5/2014 6:26 PM, Sven Barth wrote: On 05.01.2014 19:24, waldo kitty wrote: 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}