HNHacker News
TopNewBestAskShowJobs

minexew

58 karma · joined October 4, 2017

submissionscomments
minexew··on Useful GCC warning options not enabled by -Wall -Wextra
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.
minexew··on Useful GCC warning options not enabled by -Wall -Wextra
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.