[fpc-pascal] readonly variables

Michael Van Canneyt michael at freepascal.org
Sat Nov 28 20:58:33 CET 2009

On Sat, 28 Nov 2009, Anthony Walter wrote:

>> PrivateMyVariableSet is not intialised, so will have an undefined
>> (random) value when InitMyVariable is first called.
>> Mattias' code given earlier avoids this problem.
> Bzzzt. Wrong.
> 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 


More information about the fpc-pascal mailing list