convert static arrays to dynamic arrays and return, have wrong data.
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 9 05:03:47 PST 2014
On Sun, 09 Nov 2014 12:46:28 +0000
novice2 via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> int[3] test1()
> {
> int[3] arr;
> ...
> }
>
> disasm shows:
> - arr created on stack
> - arr address returned
> - stack changed
> - data lost.
hm. what i see in disasm is: array is created on the *caller* stack.
then address of that array passed to `test1()` as hidden argument, so
`test1()` actually returns nothing at all, it just changes that passed
array.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141109/ce8320ca/attachment.sig>
More information about the Digitalmars-d
mailing list