ref vs out.

Jesse Phillips jessekphillips+D at gmail.com
Mon Feb 14 07:19:53 PST 2011


Charles McAnany Wrote:

> Hi, all. So I'm new to this whole contract thing. (I'm coming from C and Java.)
> I got the impression that using foo(out arg) means that arg is given its
> default value, but other than that it's just like ref. So, here's the basic
> code I have thus far.

The init value for a dynamic array is null. Thus you have an empty array when you change to 'out', and you assign nothing into it.


More information about the Digitalmars-d-learn mailing list