[Development] Applications using -fno-rtti
Lars Knoll
lars.knoll at qt.io
Sun Jun 21 13:22:58 CEST 2020
> On 21 Jun 2020, at 13:10, Giuseppe D'Angelo via Development <development at qt-project.org> wrote:
>
> Il 20/06/20 22:45, Thiago Macieira ha scritto:
>> On Saturday, 20 June 2020 11:31:25 PDT Alberto Mardegan wrote:
>>> I think I missed an announcement about Qt applications having to use
>>> RTTI; on the opposite, I thought that the whole point of QMetaObject was
>>> not to require RTTI support; has this changed?
>> As you can see from the commit, no provision was made for no-RTTI builds. I
>> don't think they've ben allowed since 5.0.
>
> The Qt coding policy document still says that no RTTI facilities are allowed within Qt:
>
>> https://wiki.qt.io/Coding_Conventions
>
> (Unchanged since 2015; before, I'm sure that document was somewhere else, with the same contents regarding this matter.)
>
> Where/when was such a change of policy decided?
We didn’t want it in earlier versions of Qt for mainly two reasons. Early implementations had quite an overhead on library size, and dynamic_cast didn’t work reliable between DLL boundaries on Windows. Both problems have gone away many years ago.
I have to go by what I remember now, but I think we then had discussions when moving from Qt 4 to Qt 5, that we will start requiring RTTI. The reasons where that dynamic_cast<> and typeid require it and it has very little overhead on library size (as opposed to exceptions which are still optional). By that time (or maybe even earlier), we also started compiling Qt with RTTI enabled on all platforms.
But it looks like nobody ever adjusted the wiki page :/
We are making use of dynamic_cast and typeid in Qt nowadays, so I guess it’s high time we adjust the wiki.
Cheers,
Lars
More information about the Development
mailing list