<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Maybe in D7 this works and in Delphi XE7 you also can get away with
it when <br>
passing it directly to Writeln but this will throw a nice AV and the
end:<br>
<br>
program Project1;<br>
const<br>
Str = 'TEST';<br>
var<br>
Data: array of Char;<br>
s: string;<br>
begin<br>
SetLength(Data, Length(Str));<br>
Move(Str[1], Data[0], Length(Str)*SizeOf(Char));<br>
s := string(Data);<br>
end.<br>
<br>
I debugged into the code (it's calling UStrAsg) and what it does
cannot be correct because it <br>
interprets the array of Char directly as string messing around with
its refcount.<br>
<br>
Regards<br>
Stefan<br>
<br>
<div class="moz-cite-prefix">Am 25.02.2015 um 17:02 schrieb
<a class="moz-txt-link-abbreviated" href="mailto:thaddy@thaddy.com">thaddy@thaddy.com</a>:<br>
</div>
<blockquote cite="mid:54EDF222.5020008@thaddy.com" type="cite">@
Florian.
<br>
<br>
You closed the typecast from array of char to string issue.
<br>
Maybe you are right,
<br>
I just can prove that every d2-xe7 adds a #0, so a cast
(partially, agreed) works in delphi and not in fpc.
<br>
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.
<br>
<br>
With all respect,
<br>
<br>
Thaddy
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>