From the course: C++ Best Practices for Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Let the compiler help

Let the compiler help - C++ Tutorial

From the course: C++ Best Practices for Developers

Start my 1-month free trial

Let the compiler help

- [Instructor] C++ is hard, and the compiler knows the language better than you do. Let the compiler help you. Turn on all warnings that make sense. I would also advise not letting warnings go. Often, a warning is actually a bug. Here are a few compiler warning flags that I like and I hope you do too. For GCC and Clang, the options are the same. Dash wall disenables all the warnings. Dash Wextra disables some extra warnings that are not enabled by dash W all. Dash Wpedantic issues all warnings demanded by strict ISO C and C++. Dash Wunused warns about unused type definitions. For Microsoft, forward slash W4 is all reasonable warnings. Forward slash 14640 is about thread unsafe static members initialization. I would highly suggest that you take a look at the compiler's website to see if there are others that are a good fit for your development.

Contents