[fpc-pascal] readonly variables
Jürgen Hestermann
juergen.hestermann at gmx.de
Sat Nov 28 14:58:26 CET 2009
> is it possible to set a variable in a programm as a readonly variable?
Not that I am aware of. But for what reason do you want such a behaviour?
And if I think it over, this can only work at runtime (letting the program crash on the second assignment). At compile time the compiler may not exactly know which assignment is done in what order. If you set the variable in a procedure or function the compiler would have to check when this procedure is called (which can be called by another procedure and so on). The first call (and assignment) would be ok but the second should generate an error? How should the compiler know how often the routine is called? This can even be dependend on input data.
More information about the fpc-pascal
mailing list