On Thursday, 3 May 2012 at 14:04:41 UTC, bearophile wrote:
[p.21]
The compiler decides if it has to be passed by reference of
copy
procedure Do_Something
(P1 : in Huge_Structure) –- Passed by reference if too big
D offers more low-level knowlege/control here, it doesn't
decide to pass by value or reference, leaving the decision to
the programmer, I prefer D here.
But in D code like this, where a large value is passed, I'd
like the D compiler to give a warning (despite once in a while
that's exactly what you want?):
alias int[1_000] TA;
void int(TA a) {}
I was surprised a little when compiler rejected `ref in`.