Do I have to pass parameters with ref explicitly?

Elfstone elfstone at yeah.net
Sun Apr 17 03:00:28 UTC 2022


I'm reading some d-sources, and it looks like they pass big 
structs by value.
Such as:

     Matrix4x4f opBinary(string op)(Matrix4x4f rhs) { ... }

I came from a C++ background, and I would have written:

     Matrix4x4f opBinary(string op)(const ref Matrix4x4f rhs) { 
... }

I haven't found anything in the docs yet. Will the d-compiler 
optimize them into virtually the same? Can someone give me a 
reference?


More information about the Digitalmars-d-learn mailing list