Ref parameter: intended behavior or bug?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed Aug 22 04:43:29 PDT 2007
"Regan Heath" <regan at netmail.co.nz> wrote in message
news:fah2ic$2e20$1 at digitalmars.com...
> However, the liability (IMO):
>
> Which of these functions modifies 'foo'?
>
> Foo foo;
> bar(foo);
> baz(foo);
>
> You can't tell without inspecting the function signatures. Whereas with
> pointers:
>
> Foo foo;
> bar(&foo);
> baz(foo);
>
> It's quite clear, unless of course baz is passing by reference ;)
If D required 'ref' and 'out' at call site like C#, this wouldn't be an
issue.
More information about the Digitalmars-d-learn
mailing list