[Development] QTextStream::readLine(0) is an ambiguous overload in 5.5

Thiago Macieira thiago.macieira at intel.com
Sun May 17 21:21:35 CEST 2015

On Sunday 17 May 2015 22:17:04 Marc Mutz wrote:
> On Sunday 17 May 2015 15:19:49 Giuseppe D'Angelo wrote:
> > It would solve, but Qt APIs use pointers instead of references for
> > out-arguments (and that's a very good code policy).
> *Any* form of out parameter is bad code policy. Much better in virtually all
> cases to return multiple values in a small struct.
> In the case at hand, the idea is probably to reuse the capacity of the
> passed QString, so returning a struct while still allowing reuse of the
> capacity requires C++11 (taking a QString&& to avoid a refcount > 1, which
> incidentally shows how poor pointer parameter semantics really are).
> I believe it was Sean Parent who in one of his talks showed how capacity-
> preserving file reading should be implemented (iirc, by keeping the string
> as a member of an object and handing it out as a reference).

Since we're not going to implement that, I suggest renaming the function to 
"readLineInto" to solve the ambiguity.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list