The trouble I've run into with that is different compilers have different warnings, sometimes they are mutually contradictory, so it is not possible to have portable code that doesn't trigger warnings in one compiler or another.
I.e. the general problem with warnings is the language gets balkanized into multiple competing and incompatible dialects.
What should happen is to carefully examine the warnings, and adopt the best into the language Standard as errors.
For example:
if (a < b < c)
That is pretty much 100% a bug in the code. Just make it illegal already. D does.For another:
for (i = 0; i < 10; ++i);
{
...
}
Long ago, an expert C programmer came to me once and said he'd spent all day trying to figure out why his loop only executed once. I pointed to the semicolon. He sighed. I put a warning for that in the compiler. I noticed that other compilers eventually did, too.In D, it's an error.
A third example:
In the Joint Fighter coding standard, it says don't use `l` as an integer suffixe, as in `124l`, because in many fonts it looks like `1241`. Solution: D does not allow `l` as a suffix. There's is no reason to support that suffix. No reason to put it in coding standard. Do the world a favor, just make it illegal. Done!