C++ Logo

std-proposals

Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Tue, 31 Jan 2023 14:26:19 -0500
On Tue, Jan 31, 2023 at 2:07 PM Bjorn Reese via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On 1/31/23 19:51, Jonathan Wakely via Std-Proposals wrote:
> >
> >
> > On Tue, 31 Jan 2023 at 18:48, Jason McKesson via Std-Proposals
> > <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> > wrote:
>
> > Why do we want to improve type-unsafe tools like `printf` when we have
> > type-safe tools like `std::format`? We don't quite have a scanf
> > equivalent yet, but it'd be better to work on that.
> >
> >
> > And any changes to printf would have to go through the C committee
> > (WG14) not the C++ committee.
>
> It is possible to build a type-safe extension without the involvement
> of the C committee:
>
> https://github.com/rokudev/rostd/blob/main/doc/printx.adoc
> https://www.youtube.com/watch?v=9dg7dMRjyxI

That's just a library. Anybody can build a library and name their
functions whatever they want.

If you want to call it "std::printf" (which is what this proposal is
talking about: changes to the function `std::printf`), then it must
first become part of C because that's where "std::printf" comes from.

We already have a type-safe replacement for `printf`; I see no reason
to try to change printf when we could give those capabilities to our
replacement.

Received on 2023-01-31 19:26:57