StaticsTest

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

StaticsTest

Tkkemo
I'm not understanding why Addr 261 is supposed to be -2 after the program completes. My program seems to be working except for that, shouldn't both get functions return 23-15=8?
Reply | Threaded
Open this post in threaded view
|

Re: StaticsTest

cadet1620
Administrator
Tkkemo wrote
I'm not understanding why Addr 261 is supposed to be -2 after the program completes. My program seems to be working except for that, shouldn't both get functions return 23-15=8?
Static variables for Class1.vm and Class2.vm are not the same. "static 0" in Class1 refers to a different RAM location than "static 0" in Class2.

Sys.init() sets Class1's static variables to 6 and 8 and sets Class2's static variables to 23 and 15. Then it gets the difference in Class1's variables (6 - 8) and the difference in Class2's variables (23 - 15).

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: StaticsTest

Tkkemo
Thanks for the quick response. Yeah I don't know what I was thinking, I hadn't setup static variables correctly in the last project.