The African Chief wrote:
Problem: Under BP, one can do; Var S:String; Count:Integer; .... Dec(S[0], Count);
This does not compile under GPC, but "Dec(Length(S), Count)" compiles, and seems to work okay.
Then I think this is a bug in GPC, and must be prevented. The Length field of a string should only be accessible read-only.
However, there is (in the current developer version, not yet in the last beta) a built-in function AssignLength which is the proper way to directly wirte to the length field of a string (if messing with the length can be called proper at all... ;-)
Observation: This is an incompatbility b/w BP and GPC - probably because of the way strings are implemented under GPC.
Right.
Questions:
- Is GPC ever going to support the BP syntax "Dec(S[0], Count);"
?
Short answer, yes, sometime. More details can be found in some other discussions in the list.
- Is it desirable to do so ?
Yes. Mainly for the reason you described.
(obviously this would entail changes to the internal GPC string format ???)
Not changes to the "real" Pascal strings; rather, it would mean introducing a new string type with automatic conversions as far as possible.