[fpc-pascal] readonly variables
andrew.hall at shaw.ca
Sun Nov 29 00:23:06 CET 2009
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.
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.
More information about the fpc-pascal