C++ Logo


Advanced search

Re: [wg14/wg21 liaison] WG14 feelings about F-strings for C

From: Joseph Myers <joseph_at_[hidden]>
Date: Wed, 25 Oct 2023 20:26:06 +0000
On Wed, 25 Oct 2023, Niall Douglas via Liaison wrote:

> As under that paper, the C preprocessor would turn that into:
> ```
> int main(int argc, const char argv[]) {
> char buffer[256];
> for(int n = 0; n < argc; n++) {
> puts(_FormatNString(buffer, 256, "arg {}: {}\n", n, argv[n]));
> }
> return 0;
> }
> ```

What's the intended way of handling internationalization with this
feature, in cases where current code passes the printf format string to a
lookup function such as gettext (to be included in the next revision of
POSIX) which returns a translated version of the format string that might
use the POSIX extension for reordering format arguments (%2$s to refer to
the second variable argument with a %s format, etc.) if reordering is
appropriate for the language being translated to? Is there a way to
handle an argument order determined by runtime lookup on the format string
with this feature, as proposed or a natural extension thereto?

Joseph S. Myers

Received on 2023-10-25 20:26:15