Michael - I see you are one of the authors of fpc (thank you), so I assume your 
statement is true by virtue of "inside knowledge".  But this is a concern.  As 
I'm sure you will know, in Delphi globals are always initialised to zero - and 
in my experience (almost 15 years with a 30-strong Delphi developer team) it is 
universally relied upon.  Is this a case where FPC does not conform to Delphi 
behaviour?  If not, why not?  It would seem simple enough to ensure the global 
space in the heap is zeroed at allocation - or even that the compiler 
initialised each individually by "assuming" " = 0", " = nil", etc at the end of 
a global declaration if nothing else has been specified.

Regards,

Andrew Hall.

On 28 Nov 09, at 11:58 , Michael Van Canneyt wrote:

>> Global variables (even in the implementation section) are always
>> initialized to 0.
> 
> This is not guaranteed in any way. It happens to be so most of the time,
> but your code should never assume this is so, except for global Ansistring 
> variables.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to