A proposal for named arguments for C++
41–50 of 62 posts
Re: A proposal for named arguments for C++
#42I hate this idea. It just clutters the UI too much and adds noise especially if it's a UI you're familiar with. The C/C++ language is noisy enough without all this. Modern IDEs alleviate the need to be reminded inline what the values are for. On top of the fact, just about every IDE invented in the last 10 years offers code completion making this useless IMHO.
On the contrary, I would say that it cleans things up amazingly. As the language currently is, if I want to change one of the default values, I need to specify every single value up to that point. func(5,0,0,NULL,0,true,true,false,NULL,true); func(verbose: true); With named parameters, I can just specify the differences between my function call and the default values.
a Windows programmer by any chance? :)
Re: A proposal for named arguments for C++
#43Earlier quoted context omitted.
It's certainly not cross-platform, but in practice you can call C libraries on a given platform the same way, regardless of which compiler generated them.
You can do that with C++ too -- assuming they are conforming to the platform ABI. On Linux, for example, all C++ compilers can call each other's code just fine. You may be thinking of the funny situation on Windows where GCC has historically flagrantly disregarded the platform C++ ABI and implemented its own instead. I assume this decision was made as a matter of practicality: The Cygwin people didn't have the resour…
For some evidence:
See an interesting reddit thread: http://www.reddit.com/r/cpp/comments/13zex3/can_vs2010_c_lib...
And a link to a msvc blog post which lists the sizes of various containers under various versions of MSVC: http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.a...
Note that vector on x64 shrunk from 48 to 24 bytes between VC9 SP1 and VC11. That's not an ABI, it's source compatibility.
Re: A proposal for named arguments for C++
#44Why oh why do we need some parameters be positional and others be named. At the very least, it should just be one or the other style. Not some mix and match.
Re: A proposal for named arguments for C++
#45It is of some note that the order execution/passing of arguments to a C++ function is yet to be defined. For example, Whatdoesitdo (i++, i)
To pick nits, the order is defined: it's defined as being unspecified (Section 5.2.2).
Re: A proposal for named arguments for C++
#46Earlier quoted context omitted.
You can do that with C++ too -- assuming they are conforming to the platform ABI. On Linux, for example, all C++ compilers can call each other's code just fine. You may be thinking of the funny situation on Windows where GCC has historically flagrantly disregarded the platform C++ ABI and implemented its own instead. I assume this decision was made as a matter of practicality: The Cygwin people didn't have the resour…
In all fairness, Microsoft breaks abi in the standard library with every single release. They do so deliberately to reserve the right to improve implementations over time. For some evidence: See an interesting reddit thread: http://www.reddit.com/r/cpp/comments/13zex3/can_vs2010_c_lib... And a link to a msvc blog post which lists the sizes of various containers under various versions of MSVC: http://blogs.msdn.com/b/…
Re: A proposal for named arguments for C++
#47I hate this idea. It just clutters the UI too much and adds noise especially if it's a UI you're familiar with. The C/C++ language is noisy enough without all this. Modern IDEs alleviate the need to be reminded inline what the values are for. On top of the fact, just about every IDE invented in the last 10 years offers code completion making this useless IMHO.
void drawBox(int X,int Y,int W,int H);
void drawBox(int TL,int TR,int BL,int BR);
Having an extra safety for mature code offers an immediate protection, in a much more accessible fashion then competing ideas like 'concepts'.Re: A proposal for named arguments for C++
#48Please stop adding features to C++ and standardize an ABI already. The lack of an ABI is why it's impossible to call C++ libraries without an entire C++ compiler – and it generally requires generating mountains of wrapper code a la SWIG – which is then called with the C ABI. The lack of an ABI is why dynamic libraries use C for writing extensions instead of C++: C++ can literally only be called by C++ (and in fact on…
A proposal for C++ to stop being such a moving target.
I really hope it makes it into the language. A stable API for external functions and whatever ABI you want for internal functions.
Re: A proposal for named arguments for C++
#49Please stop adding features to C++ and standardize an ABI already. The lack of an ABI is why it's impossible to call C++ libraries without an entire C++ compiler – and it generally requires generating mountains of wrapper code a la SWIG – which is then called with the C ABI. The lack of an ABI is why dynamic libraries use C for writing extensions instead of C++: C++ can literally only be called by C++ (and in fact on…
http://www.swag.uwaterloo.ca/acd/docs/ItaniumC++ABI.htm
Almost every major vendor has been working towards this for a long time now.Microsoft of course remains "special".
Regardless, the C++ standards committee did look at creating a portable C++ ABI in May 2014:
https://isocpp.org/blog/2014/05/n4028Re: A proposal for named arguments for C++
#50Please stop adding features to C++ and standardize an ABI already. The lack of an ABI is why it's impossible to call C++ libraries without an entire C++ compiler – and it generally requires generating mountains of wrapper code a la SWIG – which is then called with the C ABI. The lack of an ABI is why dynamic libraries use C for writing extensions instead of C++: C++ can literally only be called by C++ (and in fact on…
Or features are wrong? What's exactly wrong with this feature? Its improvement.