Hi,

C++20 is coming along, and it brings a disruptive change, one that far surpasses the C++17 noexcept break: u8"Hello" is now const char8_t[], no longer const char[].

To estimate the amount of breakage this will cause, assuming that using u8"" is good practice today, to indicate that a string is in UTF-8. I've tried to have at least QByteArray not break... and failed.

The initial idea is simple enough: add const char8_t* overloads for const char* functions. This breaks passing nullptr, so you also add std::nullptr_t overloads. This, however, still doesn't fix the case where a 0 is passed. I've expected that the std::nullptr_t overload is a preferred match over the const char[8_t]* ones, but GCC 9.1 disagrees, and tells me it's still ambiguous.

So, if GCC is right, we have no way of adapting our API to not break in C++20. So we need to decide what to break:

a) using 0 for nullptr, or
b) using u8"Hello" at all

The forward-looking choice would be to break (a) and support (b).

Opinions?

Thanks,
Marc
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to