Tom Verhoeff wrote:
I am surprised that for ShortString, the range is not
also 1 <= i <= Length(s).
IIRC Turbo Pascal only allowed you to access s[0] when range checking
was off, and similarly for s[i] with i > Length(s).
No. See transcript:
-- 8< -- the program --
{$R+}
var
s1 : String;
Can someone confirm what range checking FreePascal does (if enabled)
when indexing a string. I imagine shortstrings and ansistrings are
handled differently, but cannot find this in the documentation.
It looks like the following:
String Type Range Checked for s[i]
---