Hi Invisible,
Invisible wrote:
> string s = "test";
>
> s[3] => 't' // so far so good
>
> s[4] => 0 // ** unexpected **
>
> s[5] => runtime_error // expected
>
>
> Is this intentional? I couldn't find it in the documentation (in fact
> doc/LPC/operators doesn't even mention strings in the section about
> "expr1[expr2]").
The corresponding documentation is in /doc/efun/[]:
In the first form, the <index> must be within the bounds of
the string/array, or a runtime error occurs.
The behavior at the string end (s[4] returning 0 instead of a runtime
error) is deprecated. With pragma warn_deprecated you'll get "Warning:
Indexing past string end is deprecated". So this may change and also
result in a runtime error in future versions.
Regards,
Gnomi.