[Development] Applications using -fno-rtti

Alberto Mardegan mardy at users.sourceforge.net
Sun Jun 21 17:22:14 CEST 2020


On 20/06/20 23:45, Thiago Macieira wrote:
> No, because it won't catch this:
> 
> class MyProcess : QProcess
> {
> protected:
>     virtual void setupChildProcess();
> };
> 
> Note the lack of Q_OBJECT.

But what is the harm if we don't catch that? It's still better than a
crash, isn't it?

Also, the documentation of QObject says (talking about Q_OBJECT):

"We strongly recommend the use of this macro in all subclasses of
QObject regardless of whether or not they actually use signals, slots
and properties, since failure to do so may lead certain functions to
exhibit strange behavior."

I guess we could then use a solution based on QMetaObject, and let the
missing Q_OBJECT cases "exhibit strange behavior"?

> But a variant of https://codereview.qt-project.org/c/qt/qtbase/+/292540 might 
> be acceptable. It would replace the typeid() check with the GCC extension, 
> which will work for all GCC-based builds, which is the totality of Linux 
> distributions.

If that is your preferred solution, I'm fine with that too. But is there
something wron gwith that patch, or can it be applied as is?

> By the way, can you say what you needed to derive from QProcess for? If it was 
> to override setupChildProcess() like in the example above, what are you doing 
> in the function?

No, that code is not overriding any virtual methods, it's just extending
the class.

Ciao,
  Alberto

-- 
http://www.mardy.it - Geek in un lingua international


More information about the Development mailing list