Re: [fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-10-04 Thread Sven Barth
On 04.10.2013 14:48, Dennis Poon wrote: You can use either FillChar as you did or use Self := Default(TTest); (default is a compiler intrinsics that returns a 0 value of the type you passed in, e.g. Nil for classes, '' for strings, 0 for ordinals and for records all fields are set to 0) How

Re: [fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-10-04 Thread Dennis Poon
Thanks a lot for clarification. Dennis Sven Barth wrote: On 04.10.2013 14:48, Dennis Poon wrote: You can use either FillChar as you did or use Self := Default(TTest); (default is a compiler intrinsics that returns a 0 value of the type you passed in, e.g. Nil for classes, '' for strings, 0

[fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-09-24 Thread Dennis Poon
if not, is there a clean and easy way to initialize the entire record memory space to zeros e.g. constructor TMyRecord.Create(TheValue : Integer); begin FillChar(self, sizeof(Self), 0); Value := TheVal; end; Is there a Self variable for advanced record methods/constructors ? By the way,

Re: [fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-09-24 Thread Dmitry Boyarintsev
If in doubt, why not to use the old-school records and an init-value procedure. thanks, Dmitry On Tuesday, September 24, 2013, Dennis Poon wrote: ** if not, is there a clean and easy way to initialize the entire record memory space to zeros e.g. constructor TMyRecord.Create(TheValue :

Re: [fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-09-24 Thread Sven Barth
does Advanced Record constructor automatically zero all the memory space of that record? No, it does not. Neither in Delphi nor in FPC. Am 24.09.2013 12:36, schrieb Dennis Poon: if not, is there a clean and easy way to initialize the entire record memory space to zeros e.g. constructor

Re: [fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-09-24 Thread Dennis Poon
Sven Barth wrote: does Advanced Record constructor automatically zero all the memory space of that record? No, it does not. Neither in Delphi nor in FPC. Am 24.09.2013 12:36, schrieb Dennis Poon: if not, is there a clean and easy way to initialize the entire record memory space to zeros

Re: [fpc-pascal] does Advanced Record constructor automatically zero all the memory space of that record?

2013-09-24 Thread Sven Barth
Am 24.09.2013 16:40, schrieb Dennis Poon: Sven Barth wrote: does Advanced Record constructor automatically zero all the memory space of that record? No, it does not. Neither in Delphi nor in FPC. Am 24.09.2013 12:36, schrieb Dennis Poon: if not, is there a clean and easy way to initialize