BP string compatibility
heckenb at mi.uni-erlangen.de
Tue Nov 18 13:31:25 CET 1997
The African Chief wrote:
> Under BP, one can do;
> Var S:String;
> Dec(S, 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... ;-)
> This is an incompatbility b/w BP and GPC - probably
> because of the way strings are implemented under GPC.
> 1. Is GPC ever going to support the BP syntax "Dec(S, Count);"
Short answer, yes, sometime. More details can be found in some other
discussions in the list.
> 2. 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
Frank Heckenbach, Erlangen, Germany
fjf at gmx.de
More information about the Gpc