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

Ivan Solovev ivan.solovev at qt.io
Tue Nov 14 17:25:34 CET 2023


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

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

Thanks,
Ivan

________________________________
From: Development <development-bounces at qt-project.org> on behalf of Thiago Macieira <thiago.macieira at intel.com>
Sent: Tuesday, November 14, 2023 5:07 PM
To: development at qt-project.org <development at qt-project.org>
Subject: Re: [Development] C++20 comparisons @ Qt (was: Re: C++20 @ Qt)

On Tuesday, 14 November 2023 04:17:18 PST Marc Mutz via Development wrote:
> It's dangerously close to q20, yes, but q20 types switch at compile-time
> between std and fall-back types, which means they cannot be used in the
> ABI (yes, I used qxp::function_ref in QTestLib, but that doesn't have a
> `using std::...`, yet, so we're still ok, and QTestLib doesn't have BC
> constraints).

Actually, how about we do exactly that: we DO NOT use them in the ABI and thus
we DO use std:: types when compiling in C++20 mode. We can only use them in
inline-only functions.

The ABI functions can return one of these other types:
  bool  (for equality comparisons)
  int  (for non-partial ordering)
  QPartialOrdering (for partial ordering)

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231114/f9687697/attachment.htm>


More information about the Development mailing list