C++ Logo

std-proposals

Advanced search

Re: [std-proposals] New printf/scanf modifiers

From: Zhihao Yuan <zy_at_[hidden]>
Date: Tue, 31 Jan 2023 23:20:56 +0000
On Tuesday, January 31st, 2023 at 12:15 PM, Arthur O'Dwyer via Std-Proposals <std-proposals_at_[hidden]> wrote:


> On Tue, Jan 31, 2023 at 1:41 PM Lee Shallis via Std-Proposals <std-proposals_at_[hidden]> wrote:
>

> >

> > hh = char8_t (In my equivalent typedef I chose to default to wchar_t
> > when char is too small in a non standards compliant implementation)
> > h = char16_t
> > ll = char32_t (since l is reserved for wchar_t and the lack thereof for char)
> > t = tchar_t (TCHAR on windows and char on linux)
> > j = char32_t (since that's currently the biggest there is, we never
> >

>

> Many of your suggestions are already standard C and C++. For example:
> printf("%hhd", sc); // signed char
> printf("%hd", ss); // signed short
> printf("%hu", us); // unsigned short
> printf("%td", d); // ptrdiff_t
> printf("%zu", z); // size_t
> printf("%jd", imax); // intmax_t


No... They is specifically talking about
applying the length modifiers on the 'c'
conversion, which currently only allows
'l' (i.e., "%lc").

It makes sense but why can't it be
"%t8c", %t16s", etc.?

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2023-01-31 23:21:02