function ref param vs pointer param

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 24 06:29:59 PDT 2015


ref2401:

> void processRef(ref MyStruct ms) {
> 	writeln("processRef: ", ms);
> }
>
> void processPointer(MyStruct* ms) {
> 	writeln("processPointer: ", *ms);

ref params don't need the "*" every time you use them inside the 
function, and don't need the "&" when you call the function.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list