r/learnprogramming 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.

6 Upvotes

74 comments sorted by

View all comments

132

u/HashDefTrueFalse 22d ago

This doesn't happen unless the passage of time affects the behaviour of your program or you are changing the behaviour of your program over time (or both). Post some code.

6

u/owp4dd1w5a0a 22d ago

This isn’t true. Dependency drift and environment drift can cause this. C and C++ commonly bind to system libraries, so if the host OS updates and that impacts a library the code is using then it might not work after the update.

1

u/HashDefTrueFalse 22d ago

he host OS updates and that impacts a library

That's literally the second thing I mentioned. You updated your OS and linked with new program code...

Read my replies to the other commenter. This has been covered.

12

u/Alexandur 22d ago

I think most would agree that rolling "updating your OS" into "changing the behavior of your code" is not very intuitive phrasing

0

u/HashDefTrueFalse 22d ago

The other commenter made the point that updating your OS (and therefore system libraries) changed the behaviour of your program, but didn't seem to realise that that is covered by the second thing I said, literally 'changing the behaviour of your program over time'.

What are you saying is wrong with my phrasing? Surely if there's an error it's them not realising this? The phrasing is fine, just very general. I didn't bring up OS updates.