[Development] C++20 comparisons @ Qt (was: Re: C++20 @ Qt)
Marc Mutz
marc.mutz at qt.io
Tue Nov 7 22:34:04 CET 2023
On 07.11.23 20:12, Thiago Macieira wrote:
> On Tuesday, 7 November 2023 06:28:51 PST Ivan Solovev via Development wrote:
[...]
>> The main reason to use `auto` is that it will allow us to avoid unnecessary
>> `std::*_ordering -> Q*Ordering -> std::*_ordering` conversions in the C++20
>> case, which will hopefully be the common case going forward.
>>
>> The main argument agains it is the possible ODR violation when mixing C++17
>> and C++20 in one binary.
>>
>> So, my question is - shoud we support mixing C++17 and C++20 in one binary?
>
> Yes. Remember that "one binary" is the process as loaded into memory,
> including all the libraries. Depending on compilation modes, inline functions
> may be merged from multiple independent libraries at runtime.
Sorry, but [citation needed]. This goes against _everything_ I know and,
more importantly, everything we've been doing the last decades, incl.
your own https://codereview.qt-project.org/c/qt/qtbase/+/389682
> So don't violate ODR.
>
> At worst, you can make them overload each other by having different parameters.
> So the Qt functions can switch between the two return type families. But you
> can't overload operators, so operators must return one family only.
--
Marc Mutz <marc.mutz at qt.io>
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