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

Marc Mutz marc.mutz at qt.io
Fri Sep 20 22:57:14 CEST 2024


On 20.09.24 11:51, Ville Voutilainen wrote:
> On Thu, 19 Sept 2024 at 17:35, Volker Hilsheimer via Development
> <development at qt-project.org> wrote:
>> My preference would be "static constexpr inline”, as static is the most important piece of information (storage and calling convention in case of member functions), constexpr is “good to know”, and inline is in practice mostly an implementation detail.
>>
>> It also has the advantage that it keeps code grep-friendly, i.e. I can search for anything “static constexpr” (which for out-of-lined members is the clear preference in existing code), and find everything, even if it’s also inline.
> 
> +1 for the order.
> 
> I can easily find people who think the constexpr is more important
> than the static, because that tells the reader that constant
> initialization is going
> to be performed. But that doesn't change my take on the order.

So what is the proposal you're all agreeing to here? "static constexpr 
inline" or Arthur's?

If we have to agree on anything, can we make it all-encompassing, like 
Arthur's suggestion, not just for the three keywords in question, please 
(and allow exceptions for late additions)?

FTR, I'm voting -1 on "static constexpr inline" (without further 
qualification), because Q_CONSTINIT must come _first_ (it's an attribute 
in C++17, keyword only in C++20), and it makes no sense to require 
constexpr and constinit to be at different positions.

Thanks,
Marc

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