View Single Post
Old July 19, 2017, 19:44   #4
AnonymousHero's Avatar
Join Date: Jun 2007
Posts: 1,393
AnonymousHero is on a distinguished road
Originally Posted by AndreyB View Post
Sometimes two code snippets can tell more than a thousand words.
I wonder how many times in my career I will make the same bug.
Edit: valgrind is awesome. It's the biggest timesaver people invented since the invention of the wheel.
UBSAN/ASAN/etc. are even better and much faster -- so fast that you can just run with it full-time without getting extremely annoyed. For example, they'll actually print the problematic source code (assuming debug info) with a little context. Do

SANITIZE_FLAGS="-fsanitize=undefined -fsanitize=address" ./configure [...]
when configuring. (I *think* I added the support in a place where you have to set it while configuring, it might also be sufficient to just add the SANITIZE_FLAGS bit before "make" on the command line.)
AnonymousHero is offline   Reply With Quote