> On Thu, 27 Sep 2007 12:38:13 +0200 (CEST) > > > Pointer(AnsiString) <> Pointer(PChar(AnsiString)) > > > > > > To get a no-op typecase you can use: > > > MyPChar:=PChar(Pointer(AnsiString)); > > > > Is this delphi compat, and if yes, what is this exactly for? > > I don't know. > > The change broke some lazarus code and now it is polluted by the ugly > double type casts, just to get some no-op type casts. > Because this fact is not widely known or often forgotten, many use the > PChar() as simple type cast. That's why the lcl interfaces already got > into troubles several times, so everytime we get strange errors I first > search for these typecasts. > Maybe we should mention this fact at a more prominent place in the > wiki and docs.
Maybe yes. I quickly checked dateutils and strutils and found a few cases that were easy to "fix". (all using a NIL checking routine immediately after) Sysutils however had 39, and I suspect several would crash when changed, since few routines have empty string early-outs like e.g. strutils has. I'm still investigating those. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal