I agree with this sentiment, and in this case the "fix" was
clear enough (put in the right number of braces), but consider:
what will you do if you need to compile with both Compiler A
*and* Compiler B, and code of the form:
void f(short s) {
...
}
produces:
warning: function f will not be compatible with K&R C
from compiler A, so you try instead:
void f(int s0) {
short s = s0;
...
}
which produces:
warning: assignment to s may truncate s0
from Compiler B, so you try something else (such as a cast or a
mask), but no matter what you do, you always get at least one
warning from at least one of the two compilers?
In extreme cases, you might even find that a single compiler produces
a warning no matter what you do. Sometimes you have to live with
warnings.
Ideally, there is some portable and clear way to write the code
that is warning-free, but sometimes "there just ain't". Occasionally
one can get rid of a warning by writing nonportable, convoluted,
fragile code instead of portable, simple, robust code; in this
case, eliminating the warning is not a good idea after all.