[Development] Proposing to officially allow C++20 types in Qt 6 ABIs

Marc Mutz marc.mutz at qt.io
Thu Jan 27 12:38:05 CET 2022


C++20 brings several new library features that would be great to use in the Qt API, foremost among them are coroutines and std::span.

Yet, both of these are, in a sense, type-erasure techniques, and therefore most useful across ABI boundaries.

Traditionally, Qt has defined a set of minimum supported C++ compilers and whatever their lowest common denominator was, that's what  could be used in the Qt ABI, everything else, let's call it conditionally-supported, could only be used in inline API.

It is worth noting that on MSVC, inline API in exported classes already forms part of the ABI, and no-one seems to have cared.

I would therefore like to propose to soften our ABI guidelines such that we can officially use said conditionally-supported types also in the ABI. This would allow to create non-inline APIs that use std::span and coroutines without having to wait for all compilers to support them.

This is not such a big step: We already have that, de facto, in MSVC. The only difference would be that a C++20 project would require a C++20(or later)-build of Qt. The error upon failure to comply would be unspectacular: linker not finding a symbol in the Qt library.

Seeing as we have allowed C++latest types in our ABI de-facto in the past, I think it's time to allow it de-jure, too.

Discuss 🙂


Marc Mutz

Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany

marc.mutz at qt.io<mailto:marc.mutz at qt.io>


Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen

Sitz der Gesellschaft: Berlin,

Registergericht: Amtsgericht Charlottenburg,

HRB 144331 B

[https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/facebook.png]<https://www.facebook.com/qt/>     [https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/twitter.png] <https://twitter.com/qtproject>    [https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/linkedin.png] <https://www.linkedin.com/company/the-qt-company/>        [https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/youtube.png] <https://www.youtube.com/QtStudios>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220127/0c8a8de9/attachment-0001.htm>

More information about the Development mailing list