[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Move unused parameter warning suppression into a macro

From: David James <james82_at_gmail.com>
Date: 2005-10-27 14:19:52 CEST

On 10/27/05, Julian Foad <julianfoad@btopenworld.com> wrote:
> 1) Mark the parameter where it appears in the parameter list. This is the best
> way for compilers that support it. We know GCC supports it; can anyone tell us
> about others?
This solution seems too complex for a small problem.

> 2) Mark the parameter in the function body. Compatible with all compilers, but
> tends to just replace one warning with another: "statement with no effect" for
> the version that goes after declarations; "unused local variable" for the
> version that goes before, except on compilers where (1) is possible.
>
>
> 3) Disable "unused parameter" warnings. (GCC: disabled by default;
> "-Wno-unused-parameter" if required. MSVC: maybe "#pragma
> warning(disable:NNNN)" ?.) This is what we (at least I) do now. The
> disadvantage is that we can't get the benefit of such warnings in functions
> where we did intend to use the parameters. However, in practice I don't think
> we actually gain very much, as we use other methods to ensure our functions
> work correctly (review and testing).
>
>
> Having seen your latest analysis above and written this response, it now looks
> to me like (1) and (3) are both better than (2).
+1 to disable unused parameter warnings, and remove all of the "(void)
parameter" hacks. The "unused parameter" warning is not a particularly
valuable one, so I don't think it's worth overthinking this.

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james
Received on Thu Oct 27 14:24:33 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.