Re: [Gc] Patch for warnings suppression in test_cpp
ivmai at mail.ru
Wed Sep 16 12:02:33 PDT 2009
"Boehm, Hans" <hans.boehm at hp.com> wrote:
> Ivan -
> What are the warnings?
For the code below: unused variable.
> T *p = X;
> T *p;
> p = X;
> seems to be an uglification.
May be. Even more, it may result in "assigned value is never used" (for other compilers).
> Does it really want
> T *p(X);
The question is not for me. I've never looked thru or run the code before. I think the equivalent code is (void)new T().
> 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.
Anyhow, not a big deal (since it's a test file) - let it remain as-is. I guess the code is correct, i.e the initial author's intent was not use use the value assigned to "p".
> > Hi!
> > The patch (ivmai141.diff) is for suppression of several
> > compiler warnings.
> > ...
More information about the Gc