[Development] (Bikeshed, pedantic) East constexpr vs West constexpr

Axel Spoerl axel.spoerl at qt.io
Wed Sep 18 17:33:35 CEST 2024


static constexpr inline
...sounds right, anything else sounds wrong to me.
________________________________
Von: Development <development-bounces at qt-project.org> im Auftrag von Thiago Macieira <thiago.macieira at intel.com>
Gesendet: Mittwoch, 18. September 2024 17:18
An: development at qt-project.org <development at qt-project.org>
Betreff: [Development] (Bikeshed, pedantic) East constexpr vs West constexpr

Which one are we?

That is,
  constexpr inline foobar
or
  inline constexpr foobar

I prefer the former. And then there's the question of the ordering when static
is present too.

Data:

we prefer to write "static inline" at 9:1
$ git sgrep 'static inline' \* '!*/3rdparty/*' | wc -l
4199
$ git sgrep 'inline static' \* '!*/3rdparty/*' | wc -l
464

and we prefer "static constexpr" at 18:1:
$ git sgrep 'static constexpr' \* '!*/3rdparty/*' | wc -l
3344
$ git sgrep 'constexpr static' \* '!*/3rdparty/*' | wc -l
181

We have a 4:1 preference to constexpr inline:
$ git sgrep 'constexpr inline' \* '!*/3rdparty/*' | wc -l
1273
$ git sgrep 'inline constexpr' \* '!*/3rdparty/*' | wc -l
341

And there are a couple of places using all three:
$ git sgrep 'static constexpr inline' \* '!*/3rdparty/*' | wc -l
57
$ git sgrep 'static inline constexpr' \* '!*/3rdparty/*' | wc -l
53
$ git sgrep 'inline static constexpr' \* '!*/3rdparty/*' | wc -l
16
$ git sgrep 'inline constexpr static' \* '!*/3rdparty/*' | wc -l
0
$ git sgrep 'constexpr inline static' \* '!*/3rdparty/*' | wc -l
0
$ git sgrep 'constexpr static inline' \* '!*/3rdparty/*' | wc -l
13

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240918/0226f90d/attachment.htm>


More information about the Development mailing list