[Lazarus] String vs WideString

Martin Schreiber mse00000 at gmail.com
Thu Aug 17 15:11:18 CEST 2017


On Thursday 17 August 2017 12:09:02 Bart via Lazarus wrote:
> 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.
>
There was none at the start.

Martin


More information about the Lazarus mailing list