C++ Logo

std-proposals

Advanced search

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

From: Lee Shallis <gb2985_at_[hidden]>
Date: Wed, 1 Feb 2023 08:24:04 +0000
I chose those modifiers because they already existed in tables like
the one here (halfway down the page)

https://cplusplus.com/reference/cstdio/scanf/

I didn't know there was yet ANOTHER committee for the printf family of
functions, I'll see if I can implement the change in my own version,
annoying that they used U8,U16 & U32 though, I once saw a vid where U
was used as a specifier for uuid_t and I rather liked that idea, I
wanted a fast custom printf, not a bogged down one by checking for
specifiers after the modifiers, so far I've gotten away with keeping
the options & modifiers in a separate set of checks from the
specifiers and the specifiers just ignoring unsupported options &
modifiers, with U8, U16 & U32 I'll have to do differently in order to
also support the U specifier. I suppose there's also the alternative
of just ignoring the standards since I'm using a separate name
(paws_printf,pawls_printf etc) but that also makes it less likely the
library I'm making will be used simply because of the different
standard, that and I'm used to using the standard modifiers, really
don't want to change my habits there

On Tue, 31 Jan 2023 at 23:21, Zhihao Yuan via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> 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.
> _______________________________________________
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-02-01 08:24:47