[fpc-devel] Wrong docs: not initialized global variables

Michael Van Canneyt michael at freepascal.org
Sun Mar 25 13:07:56 CEST 2018



On Sat, 24 Mar 2018, Ondrej Pokorny wrote:

> On 24.03.2018 23:00, Sven Barth via fpc-devel wrote:
>> Ondrej Pokorny <lazarus at kluug.net <mailto:lazarus at kluug.net>> schrieb am 
>> Sa., 24. März 2018, 20:49:
>>
>>     This is not correct. Global simple variables are always
>>     initialized. At
>>     least in Delphi it is so:
>>     http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Variables_(Delphi)
>>     <http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Variables_%28Delphi%29>
>>     "If
>>     you do not explicitly initialize a global variable, the compiler
>>     initializes it to 0."
>> 
>> 
>> So, Delphi *does* document it. Okay, in that case the documentation needs 
>> to be updated, cause up to now the assumption has been that this is an 
>> implementation detail.
>
> It has always been so in Delphi - at least since I learnt it. The Delphi 7 
> docs (I can't find older docs online) state it as well: 
> http://docs.embarcadero.com/products/rad_studio/cbuilder6/EN/CB6_ObjPascalLangGuide_EN.pdf 
> on page 5-38 "If you don’t explicitly initialize a global variable, the 
> compiler initializes it to 0." (Docs are at 
> http://docs.embarcadero.com/products/rad_studio/ )

Please file a bugreport.

Michael.


More information about the fpc-devel mailing list