Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Message-ID | <l2ucul$tg3$1@dont-email.me> (permalink) |
|---|---|
| Newsgroups | comp.std.c++ |
| From | Edward Diener <eldiener@tropicsoft.invalid> |
| Subject | Re: proposal : keyword default |
| Organization | A noiseless patient Spider |
| References | <3c07b20c$1@master.soko.hr> <f7909d88-eef3-4c68-864f-09912789dc89@googlegroups.com> <FOOdncbkK9Y5uNPPnZ2dnUVZ_sKdnZ2d@earthlink.com> <l2nojk$10h$1@dont-email.me> <u-ydncvlzM5_7szPnZ2dnUVZ7qydnZ2d@bt.com> |
| Date | 2013-10-07 15:05 -0600 |
On 10/7/2013 3:50 AM, Francis Glassborow wrote: > > On 06/10/2013 03:19, Edward Diener wrote: >> >> On 10/4/2013 2:58 PM, Paul D. DeRocco wrote: >>>> >>>> >>>> On 10/3/2013 3:25 PM, alexander.stoyan@googlemail.com wrote: >>>> >>>> Instead it would be elegant to just use: >>>> >>>> thread_t thr_id = 0; >>>> make_thread(thread_function, default, default, default, &thr_id); >>> >>> >>> >>> I didn't see the earlier parts of this thread, so this may have come up. >>> Has the idea of leaving out the arguments entirely come up? E.g., >>> >>> make_thread(thread-function, , , , &thr_id); >> >> >> >> I have always liked this idea. I see no reason for passing a keyword >> such as 'default'. Nor do I see a downside for leaving out a value >> entirely when you want the compiler to use the default value in the >> function declaration. I do not believe there is any other use for such >> a function invocation, so there is no chance of breaking existing >> code. >> >> Not passing anything should simply say "Pass the default value". If >> there is no default value for that positional parameter and the >> invoker does not pass anything it is a compiler error. Simple, >> straightforward, and cannot be confused with anything else when >> invoking a function. >> > > I would lay heavy odds that all this discussion is academic because > the current rules are not going to change ever :) How many times has that been said about almost anything only to be proved wrong ! > > If you stop to consider it, it should be clear that this would have > been considered right at the start of the design of default arguments > for C++. It wasn't that it was hard to do, so there must have been > other reasons (I am pretty sure they will have been mentioned > somewhere in 'The Design and Evolution of C++') You may be crediting Mr. Stroustrup with too much foresight. Nonetheless if you have any particular discussion to cite about this in D&E or otherwise I would be glad to peruse it. > > If anything, changing the rules now would be more difficult because > the whole language is so much more complicated. I do not see anything in the invocation of somefunction(somedata,,,someotherdata) that could be confused with anything else in C++. It does not matter that the "whole language is so much more complicated" for this one situation. Is there any other area of C++ where the syntax of commas following each other with just potentially whitespace between them is ever used ? > In addition, it is > entirely unnecessary as overloading is generally a more effective > approach as you can generally decide which parameters to default. > Inlining means that there is no loss of executable efficiency in > either space or speed. I agree that overloading is better than using default parameters in the vast majority of cases. But since default parameters are still in large use, especially in APIs not specifically geared toward C++, such as the Windows header files, why not make it easier in C++ to invoke such functions. Furthermore the same technique could be used for class templates which provide default parameters. Essentially the sequence ",," has no syntactical meaning in C++. I do realize that the comma operator can be overloaded in C++ but that has close to zero chance of interfering with using ",," to specify a default function parameter in a function invocation or a default template parameter in a class template instantiation. Nonetheless I appreciate your (dis)interest and the next step is to write a proposal for the C++ standards committee. -- [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Next in thread | Find similar
Re: proposal : keyword default alexander.stoyan@googlemail.com - 2013-10-03 13:25 -0600
Re: proposal : keyword default Daniel Krügler <daniel.kruegler@googlemail.com> - 2013-10-04 11:19 -0700
Re: proposal : keyword default "Paul D. DeRocco" <pderocco@ix.netcom.com> - 2013-10-04 11:58 -0700
Re: proposal : keyword default Bo Persson <bop@gmb.dk> - 2013-10-05 19:19 -0700
Re: proposal : keyword default Edward Diener <eldiener@tropicsoft.invalid> - 2013-10-07 01:50 -0600
Re: proposal : keyword default Edward Diener <eldiener@tropicsoft.invalid> - 2013-10-05 19:19 -0700
Re: proposal : keyword default Francis Glassborow <francis.glassborow@btinternet.com> - 2013-10-07 01:50 -0600
Re: proposal : keyword default Edward Diener <eldiener@tropicsoft.invalid> - 2013-10-07 15:05 -0600
Re: proposal : keyword default James Kuyper <jameskuyper@verizon.net> - 2013-10-08 12:36 -0700
Re: proposal : keyword default Helmut Zeisel <zei2011@liwest.at> - 2013-10-12 03:47 -0600
Re: proposal : keyword default Edward Diener <eldiener@tropicsoft.invalid> - 2013-10-12 11:36 -0600
Re: proposal : keyword default ootiib@hot.ee - 2013-10-12 23:10 -0600
Re: proposal : keyword default John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-13 11:33 -0600
Re: proposal : keyword default Edward Diener <eldiener@tropicsoft.invalid> - 2013-10-16 10:34 -0600
Re: proposal : keyword default Helmut Zeisel <zei2011@liwest.at> - 2013-10-14 20:37 -0700
Re: proposal : keyword default Alexander Terekhov <terekhov@web.de> - 2013-10-18 01:20 -0600
csiph-web