Hello all,
Is there a way to force the string type to be an alias to UnicodeString instead of AnsiString as it is by default?
I tried the obvious "type string = UnicodeString" but of course it is not allowed as string is a reserved keyword.
Regards

Mailing lists / fpc-pascal / 2012-05
9 messages · 6 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello all,
Is there a way to force the string type to be an alias to UnicodeString instead of AnsiString as it is by default?
I tried the obvious "type string = UnicodeString" but of course it is not allowed as string is a reserved keyword.
Regards
Olivier Sannier wrote on Tue, 15 May 2012:
Is there a way to force the string type to be an alias to UnicodeString instead of AnsiString as it is by default?
It is not possible in FPC 2.6.x. Wth the svn trunk version, you can use {$modeswitch unicodestrings} (in combination with {$h+}), or even better {$mode delphiunicode} (which also enable other modeswitches that have been implemented for Delphi2009+ compatibility).
Jonas
Is this new mode only a temporary experiment or will it stay?
Mattias
Mattias Gaertner wrote on Tue, 15 May 2012:
It will stay afaik, although the effects may still change to better match Delphi2009+ compatibility if required.
Jonas
I would like to understand why Delphi compatibility is so important to FPC and Lazarus.
Marcos Douglas
In my case, I'm generating a DLL on the fly with FPC, a Dll that interfaces with Delphi XE2 and that is based on code written by the software users.
Those users don't care that UnicodeString should be used, they only know of string and don't want to change all their scripts because we moved to a unicode version of Delphi. Hence the need to follow what Delphi has done and change string to be unicodestring.
I'm not saying it is a good or bad thing, I don't want to start a debate here, I just want to say that I'd prefer if I wouldn't have to reparse my users code to replace "string" with "UnicodeString" just before generating.
I would like to understand why Delphi compatibility is so important to FPC and Lazarus.…
In that case I suggest asking on the fpc-other list.
Tomas
I would like to understand why Delphi compatibility is so important to FPC and Lazarus.…
Marcos Douglas wrote on Tue, 15 May 2012:
I would like to understand why Delphi compatibility is so important to FPC and Lazarus.
Please hold that discussion on the fpc-other mailing list instead. This list is for getting help with using and programming in current FPC versions, and discussions like the above tend to explode and drown out any threads about concrete questions.
Thanks,
Jonas
FPC mailing lists admin
Tomas Hajny wroteIn that case I suggest asking on the fpc-other list.
*
Jonas Maebe wrotePlease hold that discussion on the fpc-other mailing list instead. This list is for getting help with using and programming in current FPC versions, and discussions like the above tend to explode and drown out any threads about concrete questions.
*
I'm sorry.
Well, I not was real question... just a though.
I think compatibility is very important and compatibility with other compiler is, at minimal, curious for me -- and I'm a Delphi programmer too.
But if you (and everybody) do not think the same, ok let's forget my comment. ;-)
Marcos Douglas
PS: OBones, I saw your comments, thanks.