cobines schrieb:
procedure mclass.dot(const s: string);
Here you know that you cannot modify 's'. But you may not know that
you cannot also change mclass.ftext variable, which actually 's'
points to because apparently someone called
mclass.dot(mclass.fsometext).
You *can* change mclass.ftext, but this can cause *trouble*.
Maybe it is programmer error and it should be said: "never call
mclass.dot with mclass.ftext as a parameter because it may crash".
Maybe the const should have never been there in the first place. I
would say if procedure writes to some non-local strings, never add
'const' to parameter.
Good advice :-)
DoDi
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel