Passing arguments into functions - in, out, inout, const, and contracts

Jason House jason.james.house at gmail.com
Mon Feb 12 19:45:23 PST 2007


Deewiant wrote:
> Jason House wrote:
>> I believe that everything (except maybe fundamental types such as int)
>> are passed by reference.  I'd expect "in" parameters to be considered
>> const, but I know that member functions can't be declared const.
>>
>> It seems to me that in/out/inout has no effect on how the language
>> operates.  I'm wondering how those affect the language.  Does "in"
>> impose a contract that the ending value must equal the starting value? I
>> also haven't thought of any good way to differentiate out from inout
>> from the compiler's standpoint (obviously, it makes sense to users).
> 
> Have a look at the doc: section "Function Parameters" at
> http://www.digitalmars.com/d/function.html
> 
> After getting the code example improved via Issue 511, I feel it explains things
> enough. Feel free to go file another Issue at
> http://d.puremagic.com/issues/index.cgi if you believe it's still too unclear.
> 

It's now issue 955.  I found the responses to my e-mail far more helpful 
than the online docs.


More information about the Digitalmars-d-learn mailing list