<p>Am 29.04.2017 23:56 schrieb "Marcos Douglas B. Santos" <<a href="mailto:md@delfire.net">md@delfire.net</a>>:<br>
><br>
> On Sat, Apr 29, 2017 at 5:23 PM, Marco van de Voort <<a href="mailto:marcov@stack.nl">marcov@stack.nl</a>> wrote:<br>
> ><br>
> > In our previous episode, Marcos Douglas B. Santos said:<br>
> > > I would like to write some packages that should work in FPC and Delphi.<br>
> > > I know that I will need to use {mode delphi} to do that.<br>
> > ><br>
> > > My ask is: Is there some disadvantages using this mode?<br>
> > ><br>
> > > I mean, is there something that we only can do in mode objfpc but not in<br>
> > > mode delphi, or is it just about syntax?<br>
> ><br>
> > Mostly syntax. Mode objfpc disambiguates a corner case for procedural types<br>
> > with an extra @ for assignment of procedural types, and a few other<br>
> > tightenings.<br>
> ><br>
> > The proponents of mode objfpc make a big deal out of the differences, but<br>
> > IMHO it is mostly nitpicking. And worse unnecesarily incompatible<br>
> > nitpicking.<br>
><br>
> Good to know.<br>
> I remembered something right now: Is there some problem when units<br>
> mode objfpc have "communication" with units using mode delphi about<br>
> Unicode?<br>
><br>
> If I remember well, PChar and even String is different between these<br>
> modes, right? The compiler will convert strings between them or this<br>
> is not a problem? Even using LCL?</p>
<p>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.<br>
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.<br>
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.</p>
<p>Regards,<br>
Sven</p>