Ref parameter: intended behavior or bug?
    Mike Parker 
    aldacron71 at yahoo.com
       
    Wed Aug 22 16:56:01 PDT 2007
    
    
  
Regan Heath wrote:
> 
> I think the concept of passing by reference is that when you pass by ref 
> the parameter _is_ the original variable in every possible way.  The 
> compiler might be using a proxy object to implement this, it might not 
> be, IANACW.  As such when you ask for the size of a ref parameter you're 
> asking for the size of the original variable, which in this case is the 
> size of the struct itself.
Yeah, I get it, but it still /feels/ inconsistent to me. If the size of 
a class reference is 4 bytes, then it seems to me that the size of a ref 
parameter should be the same and not the size of the object to which it 
refers. But I suppose we aren't supposed to think of a ref parameter as 
a true reference, but rather as a mutable view of the original data. In 
which case, 'inout' seems more appropriate, in retrospect, than 'ref'.
OK, misconception cleared, situation grokked.
    
    
More information about the Digitalmars-d-learn
mailing list