Gale Paeper wrote:
I don't think you can make a single range checking rule for UCSD Pascal style strings. There is some variation between different vendors' implementation in the range checking criteria enforced in accessing individual string elements of UCSD Pascal style strings.
For example, the documentation for THINK Pascal (a MacPascal dialect compiler) states range checking checks that the individual character element being accessed is within the range 1..n where n is the current length of the string whose individual character element is being accessed. The documentation also specifically notes (by example) that accessing "element" 0, e.g., MyString[0], is not allowed when the range checking option is on.
BTW, does it have some other way to modify the length then? (BP doesn't, so writing to `MyString[0]' is the only way there.)
I don't think we need to be so strict, i.e. we can always allow access to element 0 for short strings then. For the upper bound, `--mac-pascal' currently behaves like EP (i.e., length, not capacity), so I suppose that's ok.
Frank