still confused about call by reference

Nathan Reed nathaniel.reed at gmail.com
Mon Oct 29 09:17:29 PDT 2007


Hoenir wrote:
> I think I read somewhere, objects are automatically passed by reference 
> and if you add in or out it means the pointer rather than the data.

Object types in D are indeed reference types, so passing these by 
reference would mean you'd pass a reference to a reference.  (This is 
useless for 'in' parameters, but allows the expected behavior for 'out' 
parameters.)  Of course, references are implemented as pointers, but 
they're semantically distinct from pointers.

Thanks,
Nathan Reed



More information about the Digitalmars-d-learn mailing list