[Gc] Patch for warnings suppression in test_cpp
urkedal at nbi.dk
Wed Sep 16 14:44:27 PDT 2009
On 2009-09-16, Ivan Maidanski wrote:
> "Boehm, Hans" <hans.boehm at hp.com> wrote:
> > In general, my attitude has been that we don't want to mess up the code very much or slow it down in critical places in order to avoid compiler warnings. Things have gotten better recently, but historically a goal of zero compiler warnings across all possible compilers didn't seem practical.
> GCC (g++) (-Wall) is not a second-sort compiler! Not to disagree with you, my opinion is if the code is doing right it shouldn't produce a warning (provided the compiler logic for it is non-broken and "adequate"). Annotating a problematic place with a comment is not a good idea (IMHO) unless it's a time-critical place.
I think there are cases where a decent compiler will emit warnings for
decent code. E.g. GCC's warnings about uninitialised variables must
have saved me a lot of time debugging, so I wouldn't be without it.
Yet, now and then the warnings are incorrect. That may be a shortcoming
of the code analyzer which, to be fair, is faced with an undecidable
problem, or it may be due to the fact that the programmer knows things
about the data which the compiler cannot possibly know due to
modularization. I don't like warnings either, but the problem can be
mitigated with something like
# IFDEBUG(c) c
int r IFDEBUG(= 0);
More information about the Gc