Memory Checker Tools For C++?
An anonymous reader writes "These newfangled memory-managed languages like Java and C# leave an old C++ dev like me feeling like I am missing the love. Are there any good C++ tools out there that do really good memory validation and heap checking? I have used BoundsChecker but I was looking for something a little faster. For my problem I happen to need something that will work on Windows XP 64. It's a legacy app so I can't just use Boosts' uber nifty shared_ptr. Thanks for any ideas."
Some time ago i was using valgrind, but afaik it does not run under windows. I think that MS Dev has some memory leak detection built in, but it is far behind valgrind. Besides, who codes stable stuff for windows? :)
How about some Reverse Polish (aka postfix): v1 v2 +
Gets rid of all those pesky parentheses, simplifies the syntax. What's not to like, unless you're a LISP fan? ;)
For grep's sake, you could, oh, I dunno, use comments? v1 v2 +; //vectorAdd
Or, maybe write out the function name? v1.operator+(v2);
Possibly even specify the class name too? Not sure of the exact syntax, perhaps: Vector::v1.operator+(v2) or v1.Vector::operator+(v2). If postfix was allowed, maybe: v1 v2 Vector::operator+();
Oh, and are you not a fan of OOP, which I thought was the whole point of C++? Otherwise shouldn't your example be v1.vectorAdd(v2) ?
Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
- Avoid pointer arithmetic.
But why use C++ if you're not using pointer arithmetic? If you're not doing that, go to Java. I know this sounds silly, and it opens religious issues, but (aside from legacy apps, like this one) why would I want to use C++ if I'm not doing that?
I use C because it's small, fast, convenient and portable. I can code something tiny quickly.
I use Java because it's an object oriented language that helps with complex app coding.
I use C++ because I want some of that Java stuff, but I want it to bind to my memory model more realistically. ie. Pointer arithmetic.
----------------------------------- My Other Sig Is Hilarious -----------------------------------