About structs and performant handling

deadalnix deadalnix at gmail.com
Tue Mar 12 08:03:09 PDT 2013


On Tuesday, 12 March 2013 at 11:58:26 UTC, Namespace wrote:
> On Tuesday, 12 March 2013 at 09:38:19 UTC, deadalnix wrote:
>> On Tuesday, 12 March 2013 at 09:24:11 UTC, Namespace wrote:
>>>> You never gave any rationale reason on that.
>>>
>>> Because I just like to have the control over what is passed 
>>> by ref and what by value.
>>
>> I'm sorry, but what you like is exactly the opposite of a 
>> rational example.
>>
>
> I've misunderstood you, ignore my post above please.
> Well, I said "I like [...]" but I meant "It's important to 
> controll what is passed by ref and what by value.". But I 
> haven't yet an example for this. So maybe you're right. 
> Whatever, our first concern should be to stimulate thinking of 
> this and to call attention of Walter and/or Andrei.
> Then we can still debated whether such parameters should be 
> labeled as such, or not.

Here is what I think. How the thing is actually passed don't 
matter. What does matter is that the semantic is know : ie that 
the program will behave in a known way.

As a consequence, if the compiler choose to pass by ref instead 
of passing by value as an optimization, it must do so only if it 
can prove that the resulting code will do the same thing.


More information about the Digitalmars-d mailing list