> Not always. For instance, C has a lot of stuff around casting, memory management, etc. that is semantically legal but often good to warn about.
That's just what I meant. Can't change C, so issue a warning. For example,
for (i = 0; i < 10; ++i);
sum += i;
My C compiler warns about the ; and the D compiler gives an error for it. A number of common C warnings are just flat out errors in D. For another example, if (a < b < c)
likely will produce a warning in C, but it won't even parse in D (I fixed the grammar so it is not a valid construction).The fact that these pointless and buggy constructs persist in C is evidence that the language cannot be changed, hence a warning is used.