[fpc-devel] ccharset.pas, charset.pas and strings/unicode ?

Skybuck Flying skybuck2000 at hotmail.com
Wed Apr 6 08:30:01 CEST 2011


Hello,

I am having momentarily confusion about the situation with ccharset.pas and 
charset.pas and strings, ansistrings and unicode in general... ?!?

So some questions about this:

I in particularly do not understand the following uses clausule:

 {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2},

Somewhere it says something about bootstrapping and stuff like that... it 
seems to have something to do with unicode mappings...

It also said that this wasn't necessary anymore beyond version 2.2.2 or 
something ?

This seems to me like a little unicode-hack to get unicode into the compiler 
or something ?

What the hell is this ? =D

Anyway some questions about the free pascal 2.4.2 sources in relation to 
Delphi XE situation:

In the latest Delphi versions "string" is now considered a Unicode string.

What's the situation with the "options.pas" in the compiler folder ?

Lot's of string stuff and character stuff going on there... ansistring 
versus unicodestring, ansichar versus unicodechar ?

Seems a bit conflicting for what I am trying to do... which is use some of 
this code in Delphi...

So I am getting all kinds of typecast/implicit string cast warnings and 
errors and stuff and potential data loss
from "string" to "ansistring"... a bit too whacky for my taste but ok...

So to get some sense into all of this let me ask you a simple question:

1. What type of strings does free pascal use ? Especially in options.pas ?

Are these "string" types considered to be AnsiStrings or UnicodeStrings ???

And what about "char" types ? Are those AnsiChar or UnicodeChar ???

(probably also know as widechar,widestrong...)

(I have in principle done no real programming yet with the newer Delphi 
versions with the unicode stuff in it...
so this is new stuff for me... and now a bit confusion unfortunately... and 
perhaps even unavoidable confusion...
because this "reinterpretation" that "new-borland" did is now conflicting 
and causing interpretation issue's :(
so it depends on the compiler... and I don't know what free pascal does... 
so that's why I ask here...)

Also there is something I don't understand about the conditional way above:

It reads in away:

IF VERSION IS 2.2 THEN USE CCHARSET ELSE CHARSET

The thing is: I am using 2.4.2 and CHARSET is missing from 2.4.2

So perhaps this conditional was ment to read something like:

if Version > 2.2 then use CCHARSET else CHARSET; ???

So for 2.4.2 I must probably use CCHARSET.pas the thing with the confusing 
strings remains though ;)

So for messy posting... but this is messy ! ;) =D

Bye,
  Skybuck. 




More information about the fpc-devel mailing list