C++ Logo

std-proposals

Advanced search

[std-proposals] Fwd: Detect non overriden function

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 20 Mar 2022 20:04:17 -0400
---------- Forwarded message ---------
From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, Mar 20, 2022 at 7:59 PM
Subject: Re: [std-proposals] Detect non overriden function
To: organicoman <organicoman_at_[hidden]>


On Sun, Mar 20, 2022 at 2:53 PM organicoman <organicoman_at_[hidden]> wrote:
>
> Jason,
> All your explanations and reasoning is correct, but if didn't see the case I'm talking about in production, i wouldn't think about this feature.
> Please check the implementation of QProcess, which is a derived class of QIODevice, especially the function QProcess::readAll, and its 2 specialization, QProcess:: readAllStandardOutput, QProcess::readAllStandardError.
> QProcess::readAll is not overriding the base class QIODevice::readAll.

So what?

I asked for an example that would show two things. One of those things
being that if you called the interface from a derived class pointer,
you would not get the correct behavior.

I checked the documentation (https://doc.qt.io/qt-5/qprocess.html),
and not only is there nothing saying that the user should avoid
`readAll`, there is an example of using `readAll` right there in the
docs. So it doesn't matter that the function is not overridden by
`QProcess`; it *still works*. Maybe QIODevice has some handle
internally that derived classes are supposed to provide that the base
class `readAll` function uses to read the data, and QProcess hooks
standard-out to that.

I don't really care how it works; what matters is that the Qt
developers consider `QProcess::readAll` to be a first-class part of
`QProcess`'s API. So even if *you* think it should not be called, the
Qt developers do not agree and they would not tag the function with
your attribute even if it existed.

So could you provide an example of such functionality that isn't
contradicted by the very documentation of the API you're talking
about?

Received on 2022-03-21 00:04:40