What's the difference between "out" and "inout"?

Deewiant deewiant.doesnotlike.spam at gmail.com
Sun May 21 03:44:05 PDT 2006


Hasan Aljudy wrote:
> Interesting, but why? What situations need this kind of behaviour?
> 

In current D it's rarely actually needed, since objects' and arrays' contents
can be modified regardless of in, out, or inout, and it's usually the contents
and not the reference that is changed. But basically the kind of situation would
be something like the following:

void empty(out Array x) { x.length = 0; }

I hope you get the idea. It does come up quite rarely.



More information about the Digitalmars-d-learn mailing list