On Wed, May 13, 2015 at 09:44:40AM +0900, Thiago Macieira wrote: > On Wednesday 13 May 2015 02:34:28 Jan Kundrát wrote: > > Hi, > > this commit [1] added a new overload to QTextStream::readLine. As a result > > of that, calling stream.readLine(0) is now ambiguous: > > > > QString readLine(qint64 maxlen = 0); > > bool readLine(QString *line, qint64 maxlen = 0); > > > > While I can easily fix this in the caller (Konsole in this case), I'm > > wodnering whether this effect was understood at the time the change was > > merged. IMHO it's a bit more user-friendly to preserve source compatibility > > by removing the default value in the newly added overload. > > > > Should I send such a patch? > > Why write readLine(0) when it's the same as readLine() ? readLine(0) seems to > me that it's asking for a line of at most zero bytes -- we should have had > this argument default to -1 to indicate maximum length, not 0. > > Removing the default argument for the new overload will make it worse, by > making people have to write the zero when they mean unlimited. I don't like > that. The two options I will consider are: > > a) do nothing, accept and document the source incompatibility > b) modify differently so that the new API isn't ambiguous but doesn't require > people to write 0 either.
Does it have to be an *overload*? Andre' _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
