Assuming structs are cheap to copy?

Justin Johansson noreply at jj.com
Mon Jan 10 06:10:04 PST 2011


On 10/01/11 03:06, Peter Alexander wrote:
> I remember there was a discussion a little while back about how Phobos
> would assume that structs are cheap to copy, and would simply pass them
> by value.
>
> Is this assumption now "the D way"? Should we all just pass structs by
> value, assuming cheap copy construction?
>
> If so, I think this needs to be documented somewhere (assuming it isn't
> already), because it's a radical departure from C++, and also from most
> other languages (where everything is a reference type). People need to
> be aware of this.

OTOH maybe I missed your point.

Cheers
Justin



More information about the Digitalmars-d mailing list