[Development] QTextStream::readLine(0) is an ambiguous overload in 5.5
andre at familiesomers.nl
Mon May 18 11:40:27 CEST 2015
Andreas Aardal Hanssen schreef op 18-5-2015 om 11:35:
> 2015-05-18 11:10 GMT+02:00 Christian Kandeler
> <christian.kandeler at theqtcompany.com
> <mailto:christian.kandeler at theqtcompany.com>>:
> On 05/17/2015 09:57 PM, Giuseppe D'Angelo wrote:
> > On Sun, May 17, 2015 at 9:55 PM, Smith Martin
> > <Martin.Smith at theqtcompany.com
> <mailto:Martin.Smith at theqtcompany.com>> wrote:
> >> How do you get bitten by an out-reference?
> > As usual, because at call site I didn't realize the argument was
> > actually being modified. Compare
> > doSomething(param1, param2, param3);
> > doSomething(¶m1, param2, param3);
> > which one is likely to be modifying arguments?
> Both are equally likely to, unless you are a C programmer.
> Qt convention is to promote pointers for out parameters to make it
> immediately clear that your input can be modified. Out references, or
> non-const reference parameters, have traditionally been discouraged
> because they make the code harder to read. It's not about what's
> proper C/C++.
Pointers can be just as opague. In terms of the above example: I cannot
see from any of the parameters to those functions what their types are.
If they are already pointers, they may already get modified. On the
other hand: that pointer may not get modified at all.
I created https://bugreports.qt.io/browse/QTCREATORBUG-14468 for some
tooling support to get a better feedback on what's going on.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development