[PURRS-devel] Re: One last time: annoying warning

Roberto Bagnara bagnara at cs.unipr.it
Mon Sep 23 20:26:46 CEST 2002


Christian Bauer wrote:
>>In contrast, I believe the patch I am repeatedly proposing:
>>
>>1) complies with the C++ standard;
>>2) does not cause problems with any the versions of all the C++
>>    compilers we know of;
>>3) preserves the information about what the bool parameter is;
>>4) is good both for users that run with warnings on and for those
>>    switching them off.
> 
> 
> 5) Mutilates perfectly valid code in a feeble attempt to keep some nitpicking
>    compiler's trap shut.

"Mutilates"?!
Putting the argument name within comments "mutilates"?
Come on!

> 6) Doesn't make the code any more transparent. Rather the opposite.

It makes clear that the argument is _intentionally_ unused.
Pretty obvious in the specific case, but, more generally, not using function
arguments may happen (and does happen) also by mistake.

> Unused parameters are to be expected when overloading functions.

So what?

> What is it 'warning' us
> about, anyway? That the parameter is dispensable and can be removed?

No: that the parameter is not being used in the function body.
This catches a significant number of mistakes.  Many people use
g++ and compile with -Wall and they agree that it is a nice thing
to be warned about that cases.

> There's absolutely *nothing* whatsoever wrong with that line of code.

Strictly speaking, the line is not wrong but only significantly less useful
than it could be.  It only serves well the portion of your user base not using
g++ or its extra-warnings options.  It does not serve well others.

> Your
> 'fix' only serves to outsmart your compiler's warning heuristics.

It is not a heuristics in the usual sense: unused arguments are always flagged
when these warnings are enabled.  And this is so by design.  The same
functionality is available in other C++ compilers.  Guess why.

> The function
> still has one unused parameter. Why doesn't the compiler warn about that?

Because omitting the argument name is the ISO standard compliant way of
specifying that the argument is _intentionally_ unused.  While omitting
the argument altogether causes an information loss, omitting it by commenting
it out is perfectly OK.

> [...] keep some nitpicking compiler's trap shut [...]
 > A compiler that issues a warning about this needs to be gagged. [...]
 > The compiler is just too stupid/ignorant to see that. [...]
 > Your 'fix' only serves to outsmart your compiler's warning heuristics. [...]
> Accepting your fix may open the flood gates to invite all kinds of nonsense.
> [...] I despise stuff like commenting out variable names [...]

You have a very simple way to satisfy the entire user base and, in particular,
those of us compiling with extra warnings enabled.  Instead you are choosing
to disrespect users and contributors of GiNaC (and the GCC authors as an extra
bonus) by imposing your religious arguments upon them.
This is a serious mistake for anyone and for a library provider is even worse.
Anyway, starting from now, the PURRS project will reduce its dependence on
GiNaC as much as possible.  At the same time we will create a parallel CVS
repository for GiNaC + our improvements (you know, those idiotic things we like
and you despise).
Good luck

    Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it




More information about the PURRS-devel mailing list