[Development] C++20 comparisons @ Qt (was: Re: C++20 @ Qt)

Thiago Macieira thiago.macieira at intel.com
Tue Nov 14 18:20:11 CET 2023


On Tuesday, 14 November 2023 08:25:34 PST Ivan Solovev via Development wrote:
> > The ABI functions can return one of these other types:
> >  bool  (for equality comparisons)
> >  int  (for non-partial ordering)
> >  QPartialOrdering (for partial ordering)
> 
> IIUC, returning QPartialOrdering is exactly what we want to avoid, due to
> the std::partial_ordering -> QPartialOrdering (and reverse) conversions.

That boat sailed in 6.1 because QPartialOrdering is already used in QMetaType 
and QVariant API/ABI.

Ideally for new out-of-line APIs, we could return a type that is ABI-
compatible with std::partial_order. But how many of those are we going to get?

> As we figured out earlier in this discussion, by making Qt::partial_ordering
> binary compatible with std::partial_ordering, we will allow the compiler to
> optimize the code and avoid the conversions (specially if we use
> std::bit_cast).

Yes, but the impact only applies to when it needs to translate from out-of-
line to out-of-line. If either side is inline, it'll do the right thing on its 
own.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5163 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231114/86470197/attachment.bin>


More information about the Development mailing list