Hi leledumbo, You are right that they are not same:
begin setlength(a1,1); a1[0] := 12345; getvalue(@a1); getvalue(@a1[0]); end. The assembly code for the 2 getvalue() are: project1.lpr:14 getvalue(@a1); 000000000040022F 48bf40a2620000000000 movabs $0x62a240,%rdi 0000000000400239 e862ffffff callq 0x4001a0 <GETVALUE> project1.lpr:15 getvalue(@a1[0]); 000000000040023E 488b3c2540a26200 mov 0x62a240,%rdi 0000000000400246 e855ffffff callq 0x4001a0 <GETVALUE> One used movabs, and the other use mov. But why the generated assembly in my code are same? Shannon 在 六, 12月 29, 2012 at 1:26 下午,leledumbo <[email protected]> 写道: > The Assembler shows that @lib and @lib[0] are exactly same thing. The following program shows that they are NOT the same #!/usr/bin/instantfpc var a1: array of Integer; begin setlength(a1,1); writeln(ptruint(@a1)); writeln(ptruint(@a1[0])); end. output: $ chmod +x test.pas $ ./test.pas 134651632 3077795880 -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-SEGFAULT-difference-between-pointer-and-dynarray-tp4028296p4028303.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
