C++ Logo


Advanced search

Re: Portable unicode string and missing snwprintf function

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 17 Nov 2022 23:02:34 -0800
On Thursday, 17 November 2022 14:07:20 PST Nicolas M via Std-Discussion wrote:
> Snprintf and swprintf are not equivalent, because with swprintf we cannot
> determine the size to allocate to the resulting formatted string.
> Swprintf doesn't accept nullptr as an output argument, nor does it return
> the total expected size. We have to allocate buffer of increasing size and
> hope that the formatting sting and arguments are valid.
> https://stackoverflow.com/a/46289793/3412316

Please direct your comments to WG14, the C Language working group. The C++
standard team does not have any power over stdio.h functions.

Nor do we have an interest. Our answer for your problem is "use std::format
and char16_t"

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2022-11-18 07:02:37