[Lazarus] String vs WideString

Bart bartjunk64 at gmail.com
Thu Aug 17 12:09:02 CEST 2017


On 8/17/17, Luca Olivetti via Lazarus <lazarus at lists.lazarus-ide.org> wrote:


> I started using strings as communication buffers since delphi 2. There
> weren't even dynamic arrays then...

>From the Turbo Pascal Help:

"A string type variable is a sequence of characters ..."

And then when you click on "characters":

"Char type
 -----------
Variables of the ordinal type Char are used to store ASCII characters."

None of this suggests that string is a good type for storing arbitrary
byte sequences.

You misused an implementation detail of the type (Ansi)String.
And now you blame fpc.

You should have used a sane type for your buffer from the start.

Bart


More information about the Lazarus mailing list