Frank Heckenbach wrote:
For strings, range checking is BP compatible (access up to the capacity allowed) in `--borland-pascal' and `--delphi' modes and EP compatible (access only up to the current length allowed) otherwise. So in default (EP) mode code such as
if MyString[1] = '-' ...
without a check
if (MyString <> '') and ...
may now fail with a range-checking error. This is useful, since the first test was always undefined if `MyString' was empty, but in my experience so far, this has been one of the most common causes of range-checking errors in my code.
Shouldn't this depend on the internal representation of the respective string rather than the dialect ? BP compatible range checking for strings makes sense for UCSD-Pascal strings when implemented in GPC. UCSD-Pascal strings are not only used by --borland-pascal but also by --ucsd-pascal and --mac-pascal. And UCSD-Pascal strings allow access to element 0.
Regards,
Adriaan van Os