Be Wise, Sanitize - Keeping Your C++ Code Free From Bugs--Marin Peko
All is in the title.
Be Wise, Sanitize - Keeping Your C++ Code Free From Bugs
by Marin Peko
From the article:
For all of the losses it has inflicted, this pandemic has at least made us more conscious about our personal hygiene.
We’re spraying spaces, surfaces and our hands way more often, so why not sanitize our code while we’re at it? After all, software runs the world, and bugs that cause programs to malfunction can cause serious damage – much like their viral counterparts.
If you’re developing in C and C++, you know this all too well. It’s easy to allocate a piece of memory and forget to free it later, or accidentally write past the memory buffer. These issues are extremely hard to find without proper tools and often cause sporadic, sudden crashes.
Using sanitizers as you’re building and testing your program can help you catch a great deal of issues in your source code early on, including memory leaks, buffer overflows and undefined behavior.
Today, we’ll be taking a look at three types of Clang sanitizers, how they’re used and what bugs they can help us nip in the bud.
Let’s spray away!