Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #15130
| From | Miles Bader <miles@gnu.org> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Any way to defer template function overloading? |
| Date | 2012-04-02 15:32 +0900 |
| Message-ID | <87bona8x02.fsf@catnip.gol.com> (permalink) |
| References | (1 earlier) <4f788f56$0$4347$7b1e8fa0@news.nbl.fi> <jlbekq$693$1@speranza.aioe.org> <9tst77FfaaU3@mid.individual.net> <jlbf5d$8ae$1@speranza.aioe.org> <9tsu9hFfaaU4@mid.individual.net> |
Ian Collins <ian-news@hotmail.com> writes: >> Because the parameter name can help readability and help to >> understand the function, IMHO. > > Surly the argument about how to comment out the name is evidence that > simply omitting the name is the best documentation for a parameter > that isn't used? I've yet to see a case where clutter helps > readability. I think it depends. For instance, consider the initial (highest-level) definition of a virtual method. You want the parameter names because they're acting as documentation for the interface (and the method comment probably refers to them by name). But I've found that I often use an inline method body with a trivial "default definition" that doesn't reference any of the parameters (and just returns false or something). I don't want to use an out-of-line method definition for that method (it's just annoying, and the inline definition actually provides good documentation of such a trivial default), but the compiler complains because I don't reference any of the arguments[*], although obviously the arguments may be referenced by overrides. What I usually do is just comment out parameter names. [*] I actually submitted a bug report trying to make an argument that g++ shouldn't warn about unreferenced arguments in inline definitions of virtual methods, but didn't get much sympathy.... -miles -- Omochiroi!
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Any way to defer template function overloading? Qi <no@no.no> - 2012-04-01 10:05 +0800
Re: Any way to defer template function overloading? Ian Collins <ian-news@hotmail.com> - 2012-04-01 16:06 +1200
Re: Any way to defer template function overloading? Qi <no@no.no> - 2012-04-01 13:53 +0800
Re: Any way to defer template function overloading? Juha Nieminen <nospam@thanks.invalid> - 2012-04-01 17:24 +0000
Re: Any way to defer template function overloading? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-04-02 00:40 +0200
Re: Any way to defer template function overloading? Ian Collins <ian-news@hotmail.com> - 2012-04-02 11:02 +1200
Re: Any way to defer template function overloading? Juha Nieminen <nospam@thanks.invalid> - 2012-04-02 05:29 +0000
Re: Any way to defer template function overloading? Qi <no@no.com> - 2012-04-02 13:48 +0800
Re: Any way to defer template function overloading? Ian Collins <ian-news@hotmail.com> - 2012-04-02 17:53 +1200
Re: Any way to defer template function overloading? Qi <no@no.com> - 2012-04-02 13:57 +0800
Re: Any way to defer template function overloading? Ian Collins <ian-news@hotmail.com> - 2012-04-02 18:12 +1200
Re: Any way to defer template function overloading? Miles Bader <miles@gnu.org> - 2012-04-02 15:32 +0900
Re: Any way to defer template function overloading? Miles Bader <miles@gnu.org> - 2012-04-02 14:58 +0900
Re: Any way to defer template function overloading? Juha Nieminen <nospam@thanks.invalid> - 2012-04-02 10:11 +0000
Re: Any way to defer template function overloading? Qi <no@no.com> - 2012-04-02 19:04 +0800
Re: Any way to defer template function overloading? Qi <no@no.com> - 2012-04-02 19:17 +0800
Re: Any way to defer template function overloading? jgk@panix.com (Joe keane) - 2012-04-02 14:41 +0000
csiph-web