6 ms·
Yes you should only disable them locally, in as small a region as possible. Though in a lot of cases in my experience this isn't so. They're generally bulk disa
by daemin 5y ago
Yes you should only disable them locally, in as small a region as possible. Though in a lot of cases in my experience this isn't so. They're generally bulk disabled before including external third party headers, they're disabled in low level projects, they're disabled in headers so that they can be submitted.
The point is that people often disable them in ways which they shouldn't just so they can compile their code and get on with fixing their bug or implementing their feature. Mainly because warnings get treated like errors and prevent the build from succeeding.
With warnings as warnings we could take a more caretaker approach to dealing with them and we shouldn't have these situations created.
- lupire 5y agoWhy do you think that people who are so undisciplined that they disabled warnings, are so disciplined that they will fix warnings? Not disabling a warning is far easier than fixing it. A warning is only useful if it's someone else's place to fix and it's warning you that you might suffer or you they might suffer from misusing you code. Warnings are most useful at runtime where it's impossible to stop and fix.
- adrianN 5y agoI don't know. If your process is not up to the task of preventing people from bulk-disabling warnings, I wouldn't trust the process to adequately inspect warnings that don't prevent shipping.
- daemin 5y agoWell it will require a behaviour change either way. I think that keeping warnings as warnings will at least make it visible how much debt there is to fix in the project rather than hiding it behind warning disabling pragmas.
- bjourne 5y agoI think your comment illustrates well why treating "warnings as warnings" is counterproductive. People who treat warnings as warnings haven't taken a caretaker approach and so they have accumulated and are now so numerous that bulk disabling them is the only practical option!
- daemin 5y agoI have worked at (and are currently working at) places that treat warnings as errors, and if the warning is not trivial to fix it just ends up disabled. People do notice it during code reviews but it usually goes through as someone "will fix it later". So out of sight and out of mind.