[fpc-devel] Array of char
sglienke at dsharp.org
Wed Feb 25 18:41:32 CET 2015
Maybe in D7 this works and in Delphi XE7 you also can get away with it when
passing it directly to Writeln but this will throw a nice AV and the end:
Str = 'TEST';
Data: array of Char;
Move(Str, Data, Length(Str)*SizeOf(Char));
s := string(Data);
I debugged into the code (it's calling UStrAsg) and what it does cannot
be correct because it
interprets the array of Char directly as string messing around with its
Am 25.02.2015 um 17:02 schrieb thaddy at thaddy.com:
> @ Florian.
> You closed the typecast from array of char to string issue.
> Maybe you are right,
> I just can prove that every d2-xe7 adds a #0, so a cast (partially,
> agreed) works in delphi and not in fpc.
> I suggest you reconsider this. The raw pointer cast should work, which
> means an array of char should have a hidden terminator as well as a
> hidden pre.
> With all respect,
> fpc-devel maillist - fpc-devel at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel