On 20/9/24 22:15, Allan Sandfeld Jensen wrote:
On Thursday 19 September 2024 16:00:22 Central European Summer Time Thiago
Macieira wrote:
On Wednesday 18 September 2024 22:10:44 GMT-7 Marc Mutz via Development
wrote:
Enforcing one over the other would make it impossible to follow
https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Public_Headers Item
1 in certain cases. That rule has at least _some_ technical merit.
Whether inline or constexpr comes first has none, IMNSHO.

I'm thinking of new code and how we usually write code. We don't enforce the
static inline / inline static, for example, but most people write the
former. I'm just wondering which one we prefer.

I prefer which ever one people write.

Back of a paper napkin grep'ing (I didn't check for duplicates, or extraneous files in qtbase dir).

In qtbase alone:

$ rg 'inline constexpr' --glob='!3rdparty' | grep -v static | wc -l
253
$ rg 'constexpr inline' --glob='!3rdparty' | grep -v static | wc -l
1173 <<< winner

$ rg 'static inline constexpr' --glob='!3rdparty' | wc -l
21
$ rg 'static constexpr inline' --glob='!3rdparty' | wc -l
56
$ rg 'inline static constexpr' --glob='!3rdparty' | wc -l
3

$ rg 'inline static' --glob='!3rdparty' | grep -v constexpr | wc -l
139
$ rg 'static inline' --glob='!3rdparty' | grep -v constexpr | wc -l
1942

Which makes some kind of sense to me:
- "static keyword always first", that's what I've been told in code reviews (and what I tell others when I review their code)

- 'constexpr inline' is more prevalent (1173) than 'inline constexpr' (253)

So, 'static constexpr inline' is what I would type by default (before doubting myself and grep'ing in the codebase to see what's used the most in case I've forgotten).

Unlike other orders like east const vs west const, there is no difference in my 
ability or speed to parse either
forms.


Good point.


[...]

Regards,
Ahmad Samir

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to