News for hackers. Stuff that matters.

minexew

Re:Useful GCC warning options not enabled by -Wall -Wextra on Wednesday October 04, 2017 @03:03PM (#15403404)
I should have clarified more; you'd use this for switches where you need to always handle all cases. Then if a you add a new value to the enum but forget to update the switch, you get a compile-time error instead of a buggy program.
Re:Useful GCC warning options not enabled by -Wall -Wextra on Wednesday October 04, 2017 @01:21PM (#15402130)
My absolute favorite for modern C++ is

-Werror=switch

Using this, you can enforce that a switch statement over an enum value is complete (covers all cases) simply by omitting the default case.