[Development] (Bikeshed, pedantic) East constexpr vs West constexpr
Thiago Macieira
thiago.macieira at intel.com
Thu Sep 19 17:01:46 CEST 2024
On Thursday 19 September 2024 07:33:10 GMT-7 Volker Hilsheimer via Development
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.
That was my preference too, but without any formalism why. Just a gut feeling.
But Arthur's argument that static and inline are both storage keywords, so it
would be important to keep them together, whereas constexpr replaces a const
for variable declarations. Since we don't do "static const inline bool", we
ought not to put the constexpr either.
For curiosity, there is one const inline:
$ git -P sgrep 'const inline' \* '!*/3rdparty/*'
qtmultimedia/src/multimedia/darwin/qcoreaudioutils_p.h: static const inline
unsigned bufferMultiplier = 4;
> 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.
Yeah, but by the same token you could be searching for static inline, of which
we have far more in our sources.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240919/34363fb3/attachment.bin>
More information about the Development
mailing list