Am 08.12.2016 05:14 schrieb "Lars" :
>
> On Mon, December 5, 2016 4:46 am, Dennis Poon wrote:
> >
>
> >
> > Lars wrote:
> >
> >> Do you know about this feature:
> >>
> >>
> >> var SomeRec: TSomeRecord = ();
> >>
> > This is good for global variable.
> > But I wonder whether it
On Mon, December 5, 2016 4:46 am, Dennis Poon wrote:
>
>
> Lars wrote:
>
>> Do you know about this feature:
>>
>>
>> var SomeRec: TSomeRecord = ();
>>
> This is good for global variable.
> But I wonder whether it has effect in procedure's local variable since
> it requires the compiler to clear
Lars wrote:
Do you know about this feature:
var
SomeRec: TSomeRecord = ();
This is good for global variable.
But I wonder whether it has effect in procedure's local variable since
it requires the compiler to clear the record on the stack (which is at
different location every time).
Sven Barth wrote:
Am 05.12.2016 08:24 schrieb "Dennis" >:
>
> In this old statement, I don't need to know the type of aRecord
> but if I want to use Default, I have to know the exact type of the
varaible aRecord and pass it to
Am 05.12.2016 08:24 schrieb "Dennis" :
>
> In this old statement, I don't need to know the type of aRecord
> but if I want to use Default, I have to know the exact type of the
varaible aRecord and pass it to Default(aRecordType) e.g. aRecord :=
Default(aRecordType) //where
Do you know about this feature:
var
SomeRec: TSomeRecord = ();
This initializes the record without needing fillchar.
I assume your "Default()" call initializes the record initially. You can
eliminate the default() call by initializing the record as part of your
declaration.
Some criticize
In this old statement, I don't need to know the type of aRecord
but if I want to use Default, I have to know the exact type of the
varaible aRecord and pass it to Default(aRecordType) e.g. aRecord :=
Default(aRecordType) //where var aRecord : aRecordType
Is it possible to use default