5 ms·
-Wall -Werror -Wextra -pedantic that's all you need
by leif 16y ago
-Wall -Werror -Wextra -pedantic
that's all you need
- eru 16y agoI guess you also need a way to suppress spurious warnings. And C compilers normally don't warn you about follies, like using global mutable state. Or using C where it's inappropriate (or not using C where it's appropriate). Though I do agree that ridding your code of compiler warnings is a good idea in general. Because when a warning comes up afterwards, it will actually have some signalling value, instead of being ignored in a sea of similar warnings.
- leif 16y ago> I guess you also need a way to suppress spurious warnings. man gcc ... You can request many specific warnings with options beginning -W, for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning -Wno- to turn off warnings; for example, -Wno-implicit. This manual lists only one of the two forms, whichever is not the default. For further, language-specific options also refer to C++ Dialect Options and Objective-C and Objective-C++ Dialect Options. > And C compilers normally don't warn you about follies, like using global mutable state. I mean no great disrespect, but if you need a machine to remind you not to use global mutable state, get back in the oven, you're still a bit gooey on the inside.
- eru 16y agoI was just arguing against -Wall -Werror -Wextra -pedantic being __all__ you need. I don't doubt that those options are certainly part of a healthy breakfast.
- fexl 16y agoThank you. I can't stand it when I build someone's C code and am greeted with page after page of compiler warnings. It gives me a sinking feeling.