I figured that out and corrected in my prototype and was hoping no one would notice and say something like that. I started comparing memory addresses of variables during execution and I noticed that.mh wrote:Your Memory_Free doesn't do what you think it does, by the way, and you're modifying some const params in other functions.
I don't like littering everything with const. I've actually been rethinking that lately and might reserve doing so only for certain types of variables like "strings". I just worry about a typo doing something bad and const has been rather useful protecting against accidents.Not sure if that's a big deal here (const rules make my brain melt - a lot of modern code seems to be just a wall of "const" noise that it's difficult to pick much signal out of, plus they're only compile-time safety that can be circumvented if you get tricksy so I'm naturally suspicious of a false sense of security here - C++ 11 should have really defaulted to const for everything with needing to explicitly specify non-const
I previously was a rather big on static for any local function, and I have stopped doing that completely (for now at least). What I do instead is prefix those functions with lowercase "s" (so I can see the function isn't supposed to be externally access) and rely on whether or not the function prototype is at the head of the source file or in the header.
All the ins and outs of C ... much to learn about, but strangely satisfying.