Am 18.02.2016 um 21:38 schrieb Jonas Maebe:
all global variables are always zeroed.
but it is better to not rely on it because
Local variables are never zeroed
and it is not uncommon that a part from main gets moved to a procedure,
and all of a sudden you must add commands to initialize
2016-02-18 18:38 GMT-02:00 Jonas Maebe :
> Mazola Winstrol wrote:
>
>> Just to clarify: if i have a record type with a pointer field, this
>> field will always zeroed?
>>
>
> No. As mentioned, all global variables are always zeroed. The type doesn't
> matter. Local
Mazola Winstrol wrote:
Just to clarify: if i have a record type with a pointer field, this
field will always zeroed?
No. As mentioned, all global variables are always zeroed. The type
doesn't matter. Local variables are never zeroed, except if they are
managed types. A pointer is not a
2016-02-17 15:16 GMT-02:00 Jonas Maebe :
> Jonas Maebe wrote:
>
>> 3 - When i declare a pointer as a global variable or as a member of a
>>> record, can i assume that its initial value is nil?
>>>
>>
>> No.
>>
>
> Correction: all global variables are always zeroed, so
Jonas Maebe wrote:
3 - When i declare a pointer as a global variable or as a member of a
record, can i assume that its initial value is nil?
No.
Correction: all global variables are always zeroed, so that includes
pointers, records and hence also pointers in records (if those records
Mazola Winstrol wrote:
1 - Does the compiler automatically initialize all class fields when a
new instance is created?
They're called instance fields, and yes, they are zeroed. Class fields
are fields that that are unique per class type, rather than per instance.
2 - Does the compiler
Hello List,
After googled and searching in the documentation,
http://free-pascal-general.1045716.n5.nabble.com/does-Advanced-Record-constructor-automatically-zero-all-the-memory-space-of-that-record-td5716755.html
http://www.freepascal.org/docs-html/ref/refse23.html
i still have doubts about