- Overview of Compilers: gcc, clang, msvc, icc...
- An absolute minimum for all C/C++ programmers:
-Wall -Werror -Wextra -Wpedantic -Wconversion- Wall: all the warnings?
- Werror: treat warnings as errors
- Wextra: some extra warnings
- Wpedantic: no language extension
- Wconversion: no implicit conversion that loses information
- Some extra warnings that I recommend:
-Wshadow -Wunused - A useful place to inspect your code: Compiler Explorer
- Benefits of using multiple compilers
- vscode debugging
- gdb and lldb
- How to use gdb
- How to start your program
- How to abort and resume
- How to set/delete a break point
- How to view stack/register
- How to disassemble a function
- strace in Linux
- dtrace in Mac
- I'm still trying to figure out how to use this one
- clang-tidy
clang-tidy filename.clang-tidy
- There are a bunch of tools for profiling
- perf
- callgrind
- VTune
- gperftools (our focus)
- gperftools
- What is it?
- How to install?
- How to use it?
sanitizer- Address Sanitizer (detect memory issue: leaks, dangling pointers)
- Undefined Behavior Sanitizer
- Thread Sanitizer (useful for detecting data races)
leaksin macOS- MallocStackLogging
valgrindin Linux
gcov+lcov+genhtmlkcov- a much easier-to-use code coverage report generator,
- but it's very slow compared with the tools listed above (at least in macOS)
- Hyperfine
- Compare different programs
- Write your own benchmark
- Compare different functions