Hello Bill,

On Fri, May 21, 2010 at 9:43 AM, Steven Schveighoffer
<[email protected]> wrote:

void foo(int[int] x)
{
x[5] = 5;
}
void main()
{
int[int] x;
foo(x);
assert(x[5] == 5); // fails
}
And with arrays at least it's even more insidious, because sometimes
it will seem to work, and sometimes it won't.
void foo(int[] x) {
x ~= 10;
}
Caller's .length will never get updated by that, but it won't crash so
it may take a while to find the bug.

Maybe the style rule should be: dynamic arrays and AA's should be passed as const or ref.
--
... <IXOYE><



Reply via email to