[fpc-pascal] Is there some disadvantages using mode Delphi?

Marcos Douglas B. Santos md at delfire.net
Sun Apr 30 01:09:06 CEST 2017


On Sat, Apr 29, 2017 at 7:21 PM, Sven Barth via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
>> If I remember well, PChar and even String is different between these
>> modes, right? The compiler will convert strings between them or this
>> is not a problem? Even using LCL?
>
> The default string type depends on two different things, namely the mode and
> the H switch which is by default only set in the Delphi modes. H- means that
> "String" is "ShortString". H+ means that "String" is "AnsiString" as long as
> modeswitch UnicodeString is not set (which is for example the case if the
> mode is DelphiUnicode). However since the latter isn't really recommended
> yet anyway (since the RTL and especially its classes would still mainly use
> String=AnsiString) you shouldn't really run into problems there.
> The same is true for (P)Char: only if modeswitch UnicodeString is set, then
> it's an alias for (P)WideChar, otherwise it's an alias for (P)AnsiChar.
> At least the conversions between the string types are handled by the
> compiler, only PAnsiChar <=> PWideChar conversions you'd need to do
> yourself, but the compiler would complain there anyway.

Sven, thank you for this explanation.
Well, I will try.

About generics, I'm not using them (yet) so, I won't have problems.

Regards,
Marcos Douglas



More information about the fpc-pascal mailing list