[fpc-pascal] String to PString assignment?
Marco van de Voort
marcov at stack.nl
Tue Sep 29 15:03:37 CEST 2009
In our previous episode, Graeme Geldenhuys said:
>
> I'm converting a project from Sibyl (a old OS/2 IDE implement in
> SpeedSoft Pascal).
>
> Below is the code I'm trying to convert to Free Pascal. I see FPC has a
> PString type, but not FreePString() or NewPString(). Searching the FPC
> source code, I found the FP Text IDE using PString all over. The FP Text
> IDE uses this... <some PString var> := NewStr(<string>);
> Do I need this when I use String = AnsiString in my projects? Or can I
> simply do the following assignment: _Title := @NevValue;
If you want to ansistringify, assume that pstring as a whole is ansistring,
and remove all pointers and let ansistrings automatic maintenance work.
Be careful with newstr, there are multiple versions of it. (a TP and Delphi
version) see
http://wiki.freepascal.org/Textmode_IDE_development#ansistringification
Don't ever include objects and sysutils in the same unit.
More information about the fpc-pascal
mailing list