January 28, 2005 Struct bug | ||||
---|---|---|---|---|
| ||||
Here is a bug I encountered a while ago, but did not have the time to narrow down and report until now: # import std.stdio; # # struct MyStruct # { # int i; # # void display() # { # writefln("getting i=", i); # } # # void someFunc() # { # // We never call this function # void bug(MyStruct[] array) # { # // Comment out this line and the bug goes away # array[0].i = i+1; # } # # writefln("i=", i); # display(); # writefln("i=", i); # } # } # # void main() # { # MyStruct m; # m.i = 10; # m.someFunc(); # } When I run this I get (on linux, dmd 0.111) i=10 getting i=-1073754812 i=10 The middle (erroneous) value seems to vary somewhat randomly. Nick |
January 29, 2005 Re: Struct bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Attachments: | Added to DStress as http://dstress.kuehne.cn/run/bug_20050128_A.d http://dstress.kuehne.cn/run/bug_20050128_B.d Thomas |
Copyright © 1999-2021 by the D Language Foundation