[fpc-devel] Are global variables guaranteed to be zero?
Mark Morgan Lloyd
markMLl.fpc-devel at telemetry.co.uk
Thu Nov 29 12:28:04 CET 2012
michael.vancanneyt at wisa.be wrote:
> On Thu, 29 Nov 2012, Alexander Klenin wrote:
>
>> On Wed, Nov 28, 2012 at 2:29 PM, Jonas Maebe
>> <jonas.maebe at elis.ugent.be> wrote:
>>>
>>>> Will global variables and static global arrays be always initialized to
>>>> zero?
>>>
>>> Yes.
>>
>> Then I suggest to amend the first paragraph of
>> http://www.freepascal.org/docs-html/ref/refse22.html
>> which directly contradicts this.
>
> It does not directly contradict this ?
>
> For local variables the statement is 100% correct.
> 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?
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-devel
mailing list