D - Access violation
- Patrick Down (27/27) Aug 21 2003 I think this is another nested function
- Walter (4/29) Aug 23 2003 Try:
- Patrick Down (3/46) Aug 23 2003 Foo is a struct why does it need a new?
- Walter (3/49) Aug 23 2003 Sorry, you're right.
- Walter (2/2) Aug 25 2003 You're right, it's a nasty bug. I have it fixed now, fix will go out in
I think this is another nested function issue. When the array is accessed in the if statement the program bombs. struct Foo { int[] arr; } void Func(Foo bar) { void InnerFunc(int x, int y) { int a = bar.arr[y]; // Ok if(bar.arr[y]) // Access violation { } } InnerFunc(5,5); } int main(char[][] argv) { Foo bar; bar.arr.length = 10; Func(bar); return 0; }
Aug 21 2003
Try: Foo bar = new Foo(); "Patrick Down" <pat codemoon.com> wrote in message news:Xns93DEDC71D4F74patcodemooncom 63.105.9.61...I think this is another nested function issue. When the array is accessed in the if statement the program bombs. struct Foo { int[] arr; } void Func(Foo bar) { void InnerFunc(int x, int y) { int a = bar.arr[y]; // Ok if(bar.arr[y]) // Access violation { } } InnerFunc(5,5); } int main(char[][] argv) { Foo bar; bar.arr.length = 10; Func(bar); return 0; }
Aug 23 2003
"Walter" <walter digitalmars.com> wrote in news:bi8is8$4h8$1 digitaldaemon.com:Try: Foo bar = new Foo();Foo is a struct why does it need a new?"Patrick Down" <pat codemoon.com> wrote in message news:Xns93DEDC71D4F74patcodemooncom 63.105.9.61...I think this is another nested function issue. When the array is accessed in the if statement the program bombs. struct Foo { int[] arr; } void Func(Foo bar) { void InnerFunc(int x, int y) { int a = bar.arr[y]; // Ok if(bar.arr[y]) // Access violation { } } InnerFunc(5,5); } int main(char[][] argv) { Foo bar; bar.arr.length = 10; Func(bar); return 0; }
Aug 23 2003
Sorry, you're right. "Patrick Down" <pat codemoon.com> wrote in message news:Xns93E0A875E661Epatcodemooncom 63.105.9.61..."Walter" <walter digitalmars.com> wrote in news:bi8is8$4h8$1 digitaldaemon.com:Try: Foo bar = new Foo();Foo is a struct why does it need a new?"Patrick Down" <pat codemoon.com> wrote in message news:Xns93DEDC71D4F74patcodemooncom 63.105.9.61...I think this is another nested function issue. When the array is accessed in the if statement the program bombs. struct Foo { int[] arr; } void Func(Foo bar) { void InnerFunc(int x, int y) { int a = bar.arr[y]; // Ok if(bar.arr[y]) // Access violation { } } InnerFunc(5,5); } int main(char[][] argv) { Foo bar; bar.arr.length = 10; Func(bar); return 0; }
Aug 23 2003
You're right, it's a nasty bug. I have it fixed now, fix will go out in 0.71. Thanks, -Walter
Aug 25 2003