Quote:
Originally Posted by AndreyB
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
Code:
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.)