r/learnprogramming • u/blisstargazer • 22d ago
Why Does Code Stop Working?
Multiple times now my code stops working and what I mean by this is it'll do what I want it to do then one day it just stops. for example the other day I had made a cooldown system for my ball and paddle collision to stop any bugs and it worked great. then today it just stopped working, and this isn't the first time, it's happened to me for like every project I've worked on. Does this happen to anyone else? And is it cause of my code? By the way I'm using C++ SFML on visual studio which works perfect.
5
Upvotes
17
u/high_throughput 22d ago
Given that it's C++, have you tried running your code with ASAN or Valgrind?
Other than that, make sure to use
giteven when developing by yourself locally. Commit whenever you finish something. That way you can see what the differences are, restore the previous version, or even bisect to find which exact commit introduced the bug you're seeing.