Frank Heckenbach wrote:
I noticed an incorrect handling of string parameters in a few RTS routines which might cause incorrect results when reading from strings where the actual parameters are expressions (not simple variables).
`ReadStr' and `Val' might be affected, though I haven't been able to reproduce an actual problem. The rarely used `StringTFDD_Reset' is affected, that's where I found the problem. (fjf1099.pas)
As I wrote, for `ReadStr' to right thing to do is to copy the argument (this is what the standard prescribes). However, I do not know what `StringTFDD_Reset' is supposed to do. ATM it looks that `StringTFDD_Reset' assume that the arguments remain valid when reading from the corresponding file. So, the natural specification can be: "Arguments to StringTFDD_Reset must be variables, must stay unmodified as long as ....". This specification is messy and the usage is error prone, but with this specification the fix would be to change the third parameter to StringTFDD_Reset into a var parameter. OTOH if we want to promise more, then we need to think twice how we can implement this.