On Tue, 1 Jul 2008, Jeff Wormsley wrote:
> > 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? No, you understand it correct. Obviously, with Florian's type, simple low-level access is out of the question. That's the price you pay. Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal