Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Copy function behaves differently in 64-bit Delphi XE3?

In Delphi XE3, the Copy function can be used for string type with or without the third parameter. For example,

s := '1234567890';
Writeln(Copy(s, 2));

The above prints 234567890 if compiled for 32-bit EXE. However when the same code compiles to 64-bit EXE, it will print nothing.

Why is this? I have to actually change all such code to e.g. Copy(s, 2, Length(s) - 1) when porting 32-bit app to 64-bit.

like image 964
justyy Avatar asked Apr 22 '13 08:04

justyy


1 Answers

I could not reproduced the behaviour you report. When I compiled that code in a fully updated 64 bit XE3, the code produced the expected output.

I conclude that either:

  1. You have not fully updated your XE3 installation.
  2. Your code is using a different Copy function that is contained in your code.

Thanks to @bummi for pointing out the QC report that proves that item 1 is the explanation. Your solution is (obviously) to apply the updates.

like image 71
David Heffernan Avatar answered Dec 02 '22 01:12

David Heffernan