Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Not used parameter: how to disable the warning |
| Date | 2011-07-23 09:34 +1200 |
| Message-ID | <98u8mnF5aaU1@mid.individual.net> (permalink) |
| References | <j0a9jt$7f0$1@nnrp.ngi.it> <98rokkFroiU5@mid.individual.net> <7badnY-wyckYArTTnZ2dnUVZ_sidnZ2d@bestweb.net> |
On 07/23/11 04:04 AM, Kenneth Brody wrote:
> On 7/21/2011 6:47 PM, Ian Collins wrote:
>> On 07/22/11 10:35 AM, pozz wrote:
>>> Is there a universal method (valid for all C compilers) that avoids the
>>> compiler to generate a warning about a not used parameter of a function?
> [...]
>> I guess this points to another useful C++ feature that could easily be added
>> to C (allowing an unused parameter name to be omitted):
>>
>> int sum(int a, int b, int )
>> {
>> return a + b;
>> }
>
> It's not always that simple. Sometimes the parameter is unused only because
> of some #if.
>
> int sum(int a, int b, int foo)
> {
> #if USE_FOO
> DoSomething("sum",foo);
> #endif
> return(a+b);
> }
I would guess such cases are rare. Anyway, they still don't negate the
elegance of the solution.
--
Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Not used parameter: how to disable the warning pozz <pozzugno@gmail.com> - 2011-07-22 00:35 +0200
Re: Not used parameter: how to disable the warning Ian Collins <ian-news@hotmail.com> - 2011-07-22 10:47 +1200
Re: Not used parameter: how to disable the warning "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-22 02:13 -0700
Re: Not used parameter: how to disable the warning Kenneth Brody <kenbrody@spamcop.net> - 2011-07-22 12:04 -0400
Re: Not used parameter: how to disable the warning Ian Collins <ian-news@hotmail.com> - 2011-07-23 09:34 +1200
Re: Not used parameter: how to disable the warning Harald van Dijk <truedfx@gmail.com> - 2011-07-21 16:06 -0700
Re: Not used parameter: how to disable the warning pete <pfiland@mindspring.com> - 2011-07-21 20:49 -0400
Re: Not used parameter: how to disable the warning Geoff <geoff@invalid.invalid> - 2011-07-21 17:52 -0700
Re: Not used parameter: how to disable the warning Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-21 20:52 -0400
Re: Not used parameter: how to disable the warning Seebs <usenet-nospam@seebs.net> - 2011-07-22 02:51 +0000
Re: Not used parameter: how to disable the warning rudolf <r.thered@gmail.com> - 2011-07-21 20:08 -0700
Re: Not used parameter: how to disable the warning Ian Collins <ian-news@hotmail.com> - 2011-07-22 15:15 +1200
Re: Not used parameter: how to disable the warning Ralf Damaschke <rwspam@gmx.de> - 2011-07-22 09:01 +0000
Re: Not used parameter: how to disable the warning Roberto Waltman <usenet@rwaltman.com> - 2011-07-22 17:56 -0400
csiph-web