[Development] Proposing changes to https://wiki.qt.io/Qt_Coding_Style

Mårten Nordheim marten.nordheim at qt.io
Tue May 9 13:08:20 CEST 2023


> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Marc Mutz via Development
> Sent: tirsdag 9. mai 2023 08:52
> 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:
>  [...]
> - exactly one space each between if and constexpr/constinit and
> following [({]:
>  [...]

Yeah, I'd +1 these.

> - 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.

I think it was already mixed usage back then, but it's also something
I've been bothered by. I pushed this patch a while ago but never
got around to pinging anyone about it:


> - 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.

I don't really see the problem with having empty parenthesis, even if
they're optional. But as long as we're not enforcing it it doesn't make
sense as a rule either.


More information about the Development mailing list