4 ms·
Tooling did help this situation somewhat, but it is not very discoverable. If a beginner started off with a clang or gcc toolchain, then I would immediately su
by leni536 4y ago
Tooling did help this situation somewhat, but it is not very discoverable.
If a beginner started off with a clang or gcc toolchain, then I would immediately suggest the following command line options for the compiler (the exact standard version does not matter, just stick to one):
-std=c++20 -pedantic-errors -Wall -Wextra -fsanitize=address,undefined
And there are a few toolchain specific macros worth adding.
This would help with most undefined behaviors encountered as a beginner, although the sanitizers don't catch everything.
- yeputons 4y agoFor sure, I'd also add -Werror to the mix.
- leni536 4y agoIt doesn't make a huge difference, if you use your compiler interactively, albeit it requires some discipline to not ignore them. Absolutely do use -Werror on CI, where nobody even looks at logs of a passing pipeline. Without -Werror you can see all your warnings at once, for better or worse.