D - DMD 0.61 Bug
- Dario (23/23) Apr 28 2003 The following code:
- Paul Runde (31/56) Apr 28 2003 I was using printf's to try to see what was going on.
- Paul Runde (27/52) Apr 28 2003 Try this:
- Walter (1/1) May 01 2003 Looks like a bug. I'll check it out. -Walter
The following code: class MyClass { uint myFunc() { uint myInt = 13; uint mySubFunc() { return myInt; } return mySubFunc(); } } int main() { MyClass myInstance = new MyClass; printf("%i", myInstance.myFunc()); return 0; } Should print 13. It prints 4202543 instead. =) If I move "uint myInt = 13;" from myFunc's to MyClass's scope it works correctly. I hope I haven't reported an already reported bug.
Apr 28 2003
I was using printf's to try to see what was going on. class MyClass { uint myFunc() { uint myInt = 13; //printf("%d\n", myInt); uint mySubFunc() { printf("%d\n", myInt); return myInt; } //printf("%d\n", myInt); return mySubFunc(); } } int main(char[][] args) { MyClass myInstance = new MyClass; printf("%i", myInstance.myFunc()); return 0; } Run this and it returns: 4202571 4202571 Uncomment one of the other printf's and I get: 13 13 13 What would cause that? Dario wrote:The following code: class MyClass { uint myFunc() { uint myInt = 13; uint mySubFunc() { return myInt; } return mySubFunc(); } } int main() { MyClass myInstance = new MyClass; printf("%i", myInstance.myFunc()); return 0; } Should print 13. It prints 4202543 instead. =) If I move "uint myInt = 13;" from myFunc's to MyClass's scope it works correctly. I hope I haven't reported an already reported bug.
Apr 28 2003
Try this: class MyClass { uint myFunc() { uint myInt = 13; uint mySubFunc() { printf("%d\n", *(&myInt + 2)); printf("%d\n", myInt); return myInt; } return mySubFunc(); } } int main(char[][] args) { MyClass myInstance = new MyClass; printf("%i", myInstance.myFunc()); return 0; } Prints: 13 4202599 4202599 The first line is whatever number I have initialized myInt with. Dario wrote:The following code: class MyClass { uint myFunc() { uint myInt = 13; uint mySubFunc() { return myInt; } return mySubFunc(); } } int main() { MyClass myInstance = new MyClass; printf("%i", myInstance.myFunc()); return 0; } Should print 13. It prints 4202543 instead. =) If I move "uint myInt = 13;" from myFunc's to MyClass's scope it works correctly. I hope I haven't reported an already reported bug.
Apr 28 2003