099. Turn compiler warnings into errors to force code defects to be fixed.#

topic: Style

Note

This tip is a draft1.

To ensure that code defects are fixed, use options to turn the relevant compiler warnings into errors in the build system. For example

gfortran -Werror=unused-variable -Werror=unused-function

rejects the code below. Mere warnings are often ignored.



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.