Isn't it possible to use the - operator in a constructor argument?

Started by
11 comments, last by InvalidPointer 14 years, 4 months ago
Yeah I'm aware I'm not deallocating stuff, also this code is largely incomplete. I had a working pong game about a year ago but I lost the computer and the code, the code I have has been hacked together from posts I made on forums for help a while back, I have a bunch of code that does stuff, but also a bunch of the same code that doesn't really do anything together.

I used to have a physics class, renderer class, logic class, and they all had update functions, and I'd call the update of the logic class and subsequently the game would be thrown into a pong loop as I like to call it, each class updating a list of objects that are used in the game according to that classes function. It was all quite beautiful, seeing how it worked. Now it's just a hacked together mess of code that happens to compile, but doesn't do anything useful yet.
Advertisement
I just have this peeve that makes it hard for me to write new code when the whole thing won't even compile, so sometimes I hack together stuff to make it compile so I'm happy enough to continue coding.
Quote:Original post by JWColeman
Yeah I'm aware I'm not deallocating stuff, also this code is largely incomplete.

Not to come off as an ass, but that's *not* and *never should be* an excuse. Consider, for a second, a hypothetical scenario in which you write some allocation code and then put the project aside for whatever reason. When you come back to it, you've kinda lost some of your original direction on what you were doing with that particular component and work on other pieces. Months later, you go back and find out you're leaking massive amounts of memory, prompting you to go back through your now very large code base, trying to find that one case where you didn't put the proper deallocation code. Worst-case scenario? Maybe. Impossible? Hardly. This problem is only going to snowball as your projects get bigger, and doing things the correct way doesn't really entail much more effort. If you put a new somewhere, just go ahead and put the deletes in the proper place.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

This topic is closed to new replies.

Advertisement