The reason I pressed the point is that you all seem to accept uncritically the statement that reference parameters are confusing. Of all the things I get confused about in C++, reference parameters isn't one of them. I do get confused, but I can't recall ever being confused by one. Aren't they more efficient, when 0 is not a permitted value? Would swap() be as efficient with pointers?
I suppose my bias arises from my ancient past, when there were always limits to contend with. martin ________________________________________ From: development-bounces+martin.smith=theqtcompany....@qt-project.org <development-bounces+martin.smith=theqtcompany....@qt-project.org> on behalf of Alejandro Exojo <s...@badopi.org> Sent: Monday, May 18, 2015 2:56 PM To: development@qt-project.org Subject: Re: [Development] Fwd: QTextStream::readLine(0) is an ambiguous overload in 5.5 El Monday 18 May 2015, Smith Martin escribió: > You omitted that toInt(&ok) is required to test ok for null, which is not > required if ok is a reference. That's extra work in the implementation in order support a nicer API to the users, e.g. to support toInt() with the null value as default argument, in addition to the "passing a pointer makes clear that the value could be modified". And if you don't agree with argument, note that it's what Qt users might expect since Qt 4 at least: http://doc.qt.digia.com/qq/qq13-apis.html#pointersorreferences "(...) I want to share some of our findings and present the principles we've been using when designing Qt 4 (...)" And it's common in more projects and code conventions, e.g.: https://google- styleguide.googlecode.com/svn/trunk/cppguide.html#Reference_Arguments -- Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2 http://barnacity.net/ | http://disperso.net _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development