Summary on Re: [fpc-pascal] Unicode file routines proposal

Jeff Wormsley daworm10 at comcast.net
Tue Jul 1 16:05:00 CEST 2008


Marco van de Voort wrote:
> I don't understand how this can work, how can I have a compiletime solution
> for a runtime problem?
>
> procedure mystringproc (s:FlorianUnicodeString);
>
> begin
>   if encodingof(s)=utf-16 then
>     begin
>       // utf-16 code here with shiftsize 2 [] needed
>     end
>   else
>     begin
>       // utf-8 code here with shiftsize 1 [] needed
>     end;
> end;
>   
If compiler magic is at work, wouldn't all this reduce to s[1] giving 
the first char no matter the char size?  If you do something like c := 
s[1] and c is defined as char, it gets converted to a standard 0-255 
value, but c could be defined as FlorianChar and be the native char 
size.  Or am I smoking crack?

Jeff.

--
I haven't smoked for 1 year, 10 months and 2 weeks, saving $3,080.02 and 
not smoking 20,533.47 cigarettes.



More information about the fpc-pascal mailing list