[fpc-devel] Are global variables guaranteed to be zero?

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Thu Nov 29 14:13:22 CET 2012



On Thu, 29 Nov 2012, Mark Morgan Lloyd wrote:

> michael.vancanneyt at wisa.be wrote:
>
>>>> You must initialize local variables.
>>> 
>>> Are there cases where locals are set to a sane initial state, e.g. for 
>>> strings and dynamic arrays? What about (references to) objects?
>> 
>> Managed types are normally initialized. That means Ansistrings,
>> UnicodeString, and COM interfaces and dynamic arrays (maybe I forget some)
>> 
>> Classes and objects are not.
>
> By which I presume that (references to) objects are not set to nil, in the 
> same way that an integer or pointer wouldn't be set to zero or nil.

Yes.

Michael.



More information about the fpc-devel mailing list