3 ms·
Where available, my preferred solution is to compile with gcc -Wall -Werror (or equivalent); this will enable -Wswitch, causing a compile error when you fail to
by JoachimSchipper 10y ago
Where available, my preferred solution is to compile with gcc -Wall -Werror (or equivalent); this will enable -Wswitch, causing a compile error when you fail to handle an 'enum' case. Needing to fix a few obvious compile errors after a change isn't much of a burden; un-maintainable code is code that silently breaks on changes. (The same attitude leads to lot of static_assert().)
(You may also be interested in -Wswitch-enum.)
- nwmcsween 10y agoNo do not do -Wall and -Werror as Wall is arbitrary between compilers and versions.
- JoachimSchipper 10y agoYou're absolutely right that -Werror should not be the default in release tarballs, and I should have included that.