From Ada 2012
Steven Schveighoffer
schveiguy at yahoo.com
Thu May 3 10:36:24 PDT 2012
On Thu, 03 May 2012 13:03:34 -0400, Kagamin <spam at here.lot> wrote:
> 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`.
in is synonymous for "const scope".
Doing "const scope ref" yields:
"scope cannot be ref or out"
which makes sense. Just use const instead.
-Steve
More information about the Digitalmars-d
mailing list