[fpc-pascal] how to initialize a SearchRec var?
Sven Barth
pascaldragon at googlemail.com
Fri Jan 3 10:43:26 CET 2014
Am 03.01.2014 08:36 schrieb "Mark Morgan Lloyd" <
markMLl.fpc-pascal at telemetry.co.uk>:
>
> Sven Barth wrote:
>>
>> On 02.01.2014 22:27, Mark Morgan Lloyd wrote:
>>>
>>> Sven Barth wrote:
>>>>
>>>> === code begin ===
>>>>
>>>> var
>>>> dirinfo: SearchRec;
>>>> begin
>>>> dirinfo := Default(SearchRec);
>>>
>>>
>>> Out of curiosity, does this work:
>>>
>>> var
>>> dirinfo: SearchRec= Default(SearchRec);
>>>
>>
>> Not yet. It's on my ToDo list however since I implemented Default().
>
>
> That would be useful. I'm currently trying to do a line-by-line
transcription of a CPU emulator that somebody's been misguided enough to
write in JavaScript. Being able to deal concisely with things like
>
> this.memMod = [ // Array of memory module words as Float64s (8 x 4KW
each)
> null, null, null, null, null, null, null, null];
>
> would be a decided advantage.
In case of arrays you can already do the following:
=== code begin ===
const
NullMemMod: array[0..7] of Pointer(* or whatever *) = (Nil, Nil, Nil,
Nil, Nil, Nil, Nil, Nil);
// somewhere else:
Self.MemMod := NullMemMod;
=== code end ===
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140103/2a32965a/attachment.html>
More information about the fpc-pascal
mailing list