what's the difference between ref and inout in D2?
un at known.com
Fri Mar 12 15:02:34 PST 2010
> According to D2 semantics that program2 is correct, because in D you can
> use variables that are not initialized by the programmers.
> Because in C# it is not allowed to use uninitialized variables.
D's general approach is to initialize every variable and only allow
unintialized ones with explicit "= void"
And that's good behavior imho.
So "out parameters are set to the default initializer for the type of it"
(at function entrance I guess).
> So I think 'out' arguments are bug-prone in D. If you have tuples, you
> can return one of them avoiding the need for 'out' arguments
I still don't get what you mean. Have an example?
More information about the Digitalmars-d-learn