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

Marc Mutz marc.mutz at qt.io
Thu Sep 19 07:10:44 CEST 2024


On 18.09.24 17:18, Thiago Macieira wrote:
> 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.

Since they are identical, from a C++ pov, the order is not something we 
need to standardize. Item 0 applies¹.

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.

HTH,
Marc

¹ https://www.oreilly.com/library/view/c-coding-standards/0321113586/ 
Item 0: "Don’t sweat the small stuff. (Or: Know what not to standardize.)"

-- 
Marc Mutz <marc.mutz at qt.io> (he/his)
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



More information about the Development mailing list