[Lazarus] String vs WideString

Michael Van Canneyt michael at freepascal.org
Tue Aug 15 12:51:49 CEST 2017



On Tue, 15 Aug 2017, Michael Schnell via Lazarus wrote:

> On 15.08.2017 12:15, Michael Van Canneyt via Lazarus wrote:
>> What does S[2] mean in your proposal ? Is it 1, 2, 4 or even 8 bytes ?
> Regarding the users' appreciation, the S[x] notation is decently 
> incompatible between the different string types and compiler versions.

Of course not.

It's 1 byte for ansistring, 2 bytes for widestring.

The point is that the compiler knows how many bytes it is based on the
declaration of S. In your proposal, it is dynamic, if I understand it
correctly.

> There were hundreds of complains in all the appropriate forums and 
> mailing list.

Complaints about what exactly ?

>
> So not much additional harm can be done, anyway.
>
> I suggest that it should be according to the character_size definition 
> stored S, and the operation c := S[x] should transfer the appropriate 
> count of bits, provided the type of c allows for taking them.

As far as I understand your proposal, this currently cannot be done ?

The compiler needs to know the S[X] size at compile time.

Michael.


More information about the Lazarus mailing list