in / out for C++ programmers
Jonathan M Davis
jmdavisProg at gmx.com
Fri Mar 23 23:36:50 PDT 2012
On Saturday, March 24, 2012 07:28:08 Dan wrote:
> When would you use in / out parameters instead of ref & const
> keywords?
out sets the variable to its init value, so you don't run into issues with
the behavior of the function changing based on the value of the variable
that you passed in. out is intended for variables that are for returning an
extra value from the function, not passing one in. You use ref if you want
to actually use the value that you pass in.
in is the same as const scope and has nothing to do with ref at all.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list