[Development] std::format support for Qt string types

Alexey Edelev alexey.edelev at qt.io
Wed Jun 19 11:23:27 CEST 2024


Hi,

I have a side question for this discussion(raised by Ivan in personal conversation): Should we also force the -fexec-charset= for the gcc-like compilers? Currently we use the system default one, which in most cases is UTF-8.

Regards,
Alexey


Alexey Edelev

Software Engineer

Qt Group
Erich-Thilo-Str. 10 12489
Berlin, Germany

alexey.edelev at qt.io

www.qt.io<https://www.qt.io>

[https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/Qt-Group-logo-black-1.png]<https://www.qt.io/>
[https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/facebook-x2-right.png]<https://www.facebook.com/qt/>    [https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/twitter-x2.png] <https://twitter.com/qtproject>         [https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/linkedin-x2.png] <https://www.linkedin.com/company/qtgroup/>    [https://s3.eu-north-1.amazonaws.com/email-signature-tool-leroy/youtube-x2.png] <https://www.youtube.com/QtStudios>
________________________________
From: Development <development-bounces at qt-project.org> on behalf of Ivan Solovev via Development <development at qt-project.org>
Sent: Thursday, June 13, 2024 2:05 PM
To: development at qt-project.org <development at qt-project.org>
Subject: Re: [Development] std::format support for Qt string types

So, I dropped a message to the SG16 mailing list, and I got a link to a new
paper as an answer: https://wg21.link/P3258

As I read it, the key point for us is that the formatter output should use
the literal encoding of the format string, or fall back to the execution
encoding.

AFAIK, we in Qt already assume that the literal and execution encoding is
UTF-8. That's the case for Linux and macOS, and for MSVC we explicitly pass
the /utf8 flag to enable the same behavior.

As a result, UTF-8 seems to be the right choice for the char formatters.

Best regards,
Ivan

------------------------------

Ivan Solovev
Senior Software Engineer

The Qt Company GmbH
Erich-Thilo-Str. 10
12489 Berlin, Germany
ivan.solovev at qt.io
www.qt.io

Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B

________________________________________
From: Development <development-bounces at qt-project.org> on behalf of Thiago Macieira <thiago.macieira at intel.com>
Sent: Friday, June 7, 2024 6:25 PM
To: development at qt-project.org
Subject: Re: [Development] std::format support for Qt string types

On Friday 7 June 2024 08:40:33 GMT-7 Ivan Solovev via Development wrote:
> IIUC, the problem of extra allocations is covered by the transcoding
> iterators and views in the paper that was linked by Giuseppe.

Yes and no.

That appears to transfer the responsibility of transcoding to the formatter,
which may be acceptable for std::format() on std::string or for std::print(),
because for those, performance and code bloat are entirely unimportant.

The question I want to see addressed is performance when we begin using format
to replace QString::arg() and thus tr(). We have highly-specialised conversion
code because this is critical to us and I'd like to see it used. So how do we
ensure that in those contexts we use our code, which is not and cannot be
inline?

How do we format onto a QString?

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Fleet Engineering and Quality
--
Development mailing list
Development at qt-project.org
https://lists.qt-project.org/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240619/14114046/attachment-0001.htm>


More information about the Development mailing list