[Lazarus] String vs WideString

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Aug 16 01:17:32 CEST 2017


On 2017-08-15 23:41, Luca Olivetti via Lazarus wrote:
> A "string" was just a handy container for bytes so I think it was the
> right choice for storing, er, bytes.


The type "String" has always been an alias to another type, and could 
mean many things. eg: ShortString, AnsiString, and now UnicodeString. 
Making the assumption that it will always be a container for byte sized 
data was wrong.

In hind sight, using TBytes or TMemoryStream and it would have been very 
clear that it is a storage container for byte sized data, and no 
automatic conversion (by the compiler) would be done to data stored in 
such containers.

Don't worry though, you were not alone in making that wrong assumption. 
Many Delphi developers have made that mistake, and some are still making 
that mistake today.

Regards,
   Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


More information about the Lazarus mailing list