Re: [fpc-pascal] Question: range checking for string indexing

2008-10-29 Thread Vinzent Höfler
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;

[fpc-pascal] Question: range checking for string indexing

2008-10-29 Thread Tom Verhoeff
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] ---