Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #15223

Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you?

From Qi <no@no.no>
Newsgroups comp.lang.c++
Subject Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you?
Date 2012-04-05 14:17 +0800
Organization Aioe.org NNTP Server
Message-ID <jljdds$teq$1@speranza.aioe.org> (permalink)
References <jlc1qv$kjj$2@speranza.aioe.org>

Show all headers | View raw


Thanks all for your input.

Here is my update.

I did a search, found more than 400 (void)param in about
35K lines of code.
I removed more than 200, and found it really worth my time.
Because I found even I (void) some parameters, latter
I added code to use the parameter but forgot to remove
the (void). That's terribly confusing and significantly
reduced code readability.

Now I use the commented out parameter name,
void func(int /*param*/);
Then there is no way to use an "unused" parameter.
Safe and clear.

Also I removed parameters that will never be used.

There are still more than 100 (void) in my code.
Most are in tool-generate code so I won't fix them
otherwise I need to change the tool a lot.
Others are in unit test that less harmful.


-- 
WQ

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Qi <no@no.com> - 2012-04-02 19:16 +0800
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? "Fred Zwarts \(KVI\)" <F.Zwarts@KVI.nl> - 2012-04-02 13:39 +0200
    Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Victor Bazarov <v.bazarov@comcast.invalid> - 2012-04-02 09:49 -0400
      Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Qi <no@no.com> - 2012-04-02 22:01 +0800
        Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Victor Bazarov <v.bazarov@comcast.invalid> - 2012-04-02 11:50 -0400
        Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Paul N <gw7rib@aol.com> - 2012-04-02 12:54 -0700
      Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Juha Nieminen <nospam@thanks.invalid> - 2012-04-03 05:27 +0000
        Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-03 08:02 +0000
          Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Juha Nieminen <nospam@thanks.invalid> - 2012-04-03 14:19 +0000
    Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Mike McCarty <mcmccarty@gmail.com> - 2012-04-02 06:43 -0700
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? GM <GM@no.spam.it> - 2012-04-02 14:41 +0200
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? bartek szurgot <basz@no.spam> - 2012-04-02 16:55 +0200
    Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Juha Nieminen <nospam@thanks.invalid> - 2012-04-03 05:28 +0000
      Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Qi <no@no.com> - 2012-04-03 13:54 +0800
        Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Juha Nieminen <nospam@thanks.invalid> - 2012-04-03 14:09 +0000
          Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Robert Wessel <robertwessel2@yahoo.com> - 2012-04-03 11:21 -0500
            Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? bartek szurgot <basz@no.spam> - 2012-04-04 17:39 +0200
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-02 15:13 +0000
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? "MikeWhy" <boat042-nospam@yahoo.com> - 2012-04-02 11:37 -0500
    Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Qi <no@no.com> - 2012-04-03 10:29 +0800
      Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-04-03 06:00 +0200
        Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Qi <no@no.com> - 2012-04-03 13:56 +0800
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? goran.pusic@gmail.com - 2012-04-02 04:25 -0700
    Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? scott@slp53.sl.home (Scott Lurndal) - 2012-04-02 22:01 +0000
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Öö Tiib <ootiib@hot.ee> - 2012-04-02 07:37 -0700
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Dombo <dombo@disposable.invalid> - 2012-04-03 19:35 +0200
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Stuart Redmann <DerTopper@web.de> - 2012-04-04 11:56 -0700
  Re: Need your experience: is "(void)param;" to avoid unused variable warnings well known for you? Qi <no@no.no> - 2012-04-05 14:17 +0800

csiph-web