[Development] Avoid QT_BEGIN_NAMESPACE..QT_END_NAMESPACE in Qt examples
Kai Köhne
Kai.Koehne at qt.io
Wed Sep 13 16:43:51 CEST 2023
Hi,
I suggest extending QUIP 13 [1] with a paragraph explaining that we shouldn't pre-declare Qt types in Qt examples:
https://codereview.qt-project.org/c/meta/quips/+/503709
For the reasoning: While it's good practice to pre-declare referenced types in header files in our tools and Qt library sources, the need to deal with 'çustom namespaced' Qt (QT_BEGIN_HEADER, QT_END_HEADER, QT_FORWARD_DECLARE_CLASS) makes this rather ugly for Qt examples. It furthermore gives bad precedence to Qt users, who might 'cargo-cult' the magic macros in their sources. Finally, as the Qt examples are rather small, the benefits of this optimization are neglectable.
Happy to hear any feedback, either here or, preferably, in the Gerrit commit.
Kai
[1]: https://contribute.qt-project.org/quips/13
--
Kai Köhne, Director R&D | The Qt Company
The Qt Company GmbH, Erich-Thilo-Str. 10, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Development
mailing list