[fpc-devel] Unicode proceedings

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Nov 18 18:39:59 CET 2011


DaWorm schrieb:
> Perhaps a little extra compiler magic could be used?  If the base 
> definition of a string (the hidden stuff before the data) contains not 
> only a field with the encoding, but a flag indicating the disposition of 
> the encoding, then when a string type is aliases, that disposition could 
> be overridden.  I'm on my phone, so this may be hard to show an example:
> 
> type String = record
>   encoding: TEncoding;
>   disposition: Tdisposition;
>   data: Tbytes;
> end;

That's not easily feasable, as long as empty strings are implemented as 
Nil pointers. When reference counting etc. should be preserved, the 
additional information had to be moved into an static string descriptor, 
together with the pointer to the dynamic string content. And what about 
temporary strings, used in string expressions?

I don't think that an added "disposition" will improve anything, because 
its value has to be checked with every access to a string variable. With 
strictly typed strings (of fixed encoding) all checks can be performed 
at compile time.

DoDi




More information about the fpc-devel mailing list