Code security: "auto" / Reason for errors
Ozan via Digitalmars-d
digitalmars-d at puremagic.com
Wed Mar 2 12:01:01 PST 2016
> It'd do exactly the same thing if you wrote
>
> int[] b = a;
>
> so the auto changes nothing there. Generally, the slice
> assignment is a good thing because it gives you easy efficiency
> and doesn't hide the costs of a duplicate.
I agree for slices, but typically variables should have his own
data.
To add additional code for separate data has a lot of risk in my
mind.
Behaviors should also be the same.
int a = 1:
int b = a; // data copy
int[] a;
int[] b = a; // pointer copy
is not the same and should be avoid.
Regards, Ozan
More information about the Digitalmars-d
mailing list