I can't get passing an array by reference to work anymore...

TheGag96 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 24 19:37:19 PDT 2015


So I'm just doing a small test program here: 
http://pastebin.com/UYf2n6bP

(I'm making sure I know quicksort for my algorithms class, I know 
functionally this won't work as-is)

I'm on Linux, 64-bit, DMD 2.068.1, and when I try to compile this 
I'm getting:

quicksort.d(18): Error: function quicksort.quickSort (ref int[] 
arr) is not callable using argument types (int[])
quicksort.d(19): Error: function quicksort.quickSort (ref int[] 
arr) is not callable using argument types (int[])

No matter how I attempt to define the array test, it will never 
allow me to pass it by reference no matter what. I even 
copy-pasted some example code from here 
(https://en.wikibooks.org/wiki/D_(The_Programming_Language)/d2/Pointers,_Pass-By-Reference_and_Static_Arrays#Pass_By_Reference, bottom of the page), and it gave the same error.

What's the problem here? I SWEAR I've passed arrays by reference 
before just like this. Thanks guys.


More information about the Digitalmars-d-learn mailing list