[fpc-pascal] readonly variables
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Nov 29 15:11:44 CET 2009
On 28 Nov 2009, at 22:34, Michael Van Canneyt wrote:
> It was Jonas Maebe (Jonas, correct me if I'm wrong) who pointed
> out (already some time ago) that this behaviour is purely coincidental (but admittedly convenient), and should not be taken for granted.
That's correct,
Usually, this is brought up in the context of the warning
Variable "yyy" does not seem to be initialized
in reference to a global variable. The argument is that this warning is wrong in that context, since it is actually initialised (with 0). While the answer that this is not guaranteed is correct in theory (as in "in terms of what the Pascal standard mandates"), the fact that TP and Delphi do guarantee this and that many people rely on this behaviour probably means that we will also always guarantee it.
Maybe we should simply reword the warning to read
Variable "yyy" may be read before it is written
or something similar (although that's not directly relevant to this discussion).
Jonas
More information about the fpc-pascal
mailing list