[Development] Proposing changes to https://wiki.qt.io/Qt_Coding_Style
Ivan Solovev
ivan.solovev at qt.io
Tue May 9 17:54:30 CEST 2023
Hi!
+1 to all suggestions
Best regards,
Ivan
________________________________
From: Development <development-bounces at qt-project.org> on behalf of Marc Mutz via Development <development at qt-project.org>
Sent: Tuesday, May 9, 2023 8:51 AM
To: qt-dev <development at qt-project.org>
Subject: [Development] Proposing changes to https://wiki.qt.io/Qt_Coding_Style
Hi,
I'd like to propose the following clarifications:
- no space between "operator" and it's symbol:
// WRONG
bool operator ==(~~~~)
// CORRECT
bool operator==(~~~~)
Rationale: that's the style we find in all of Qt, but QtC's
auto-completion (by default?) adds the space, so we should clarify what
we want (and fix QtC).
- exactly one space each between if and constexpr/constinit and
following [({]:
// WRONG
if constinit(
if constexpr(~~~) {
// CORRECT
if constinit {
if constexpr (~~~) {
- space after template and before <:
// WRONG
template<class T>
// CORRECT:
template <class T>
Rationale: We always used the latter in Qt. Then a faulty _clang-format
that dropped the space for unknown reasons was added to qt5.git and
since then, we have a wild mix. We should fix the faulty _clang-format
file and codify just one variant in the normative document,
https://wiki.qt.io/Qt_Coding_Style.
- drop the requirement for () in lambdas
Rationale: this was a word-around for older MSVCs. The standard doesn't
require the empty parameter list (except when adorning the lambda with
noexcept etc, and then the compiler complains) and people have voted
with their feet: we now have many uses of [] {} in Qt already.
Thanks,
Marc
--
Marc Mutz <marc.mutz at qt.io>
Principal Software Engineer
The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B
--
Development mailing list
Development at qt-project.org
https://lists.qt-project.org/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230509/de2b3b33/attachment.htm>
More information about the Development
mailing list