C++ Logo


Advanced search

Re: Fwd: Internal fill *not* considered harmful (re: P1652)

From: Zhihao Yuan <zy_at_[hidden]>
Date: Wed, 26 Jun 2019 15:59:46 +0000
On Wednesday, June 26, 2019 9:35 AM, Matthew Woehlke <mwoehlke.floss_at_[hidden]> wrote:

> > Look, in your example, {:06}, and only {:06}, generates an output
> > that can be parsed by strtod.
> If your criteria for whether or not a feature should be allowed is
> "produces output that can be parsed by strtod", then maybe you should
> remove the ability to specify the fill character also:
> {:0>6} → "00-123", "000inf"
> {:0<6} → "-12300", "inf000"

"generating weird output is okay,
confusing people is not" (why I have
to quote myself?) These two output
"00-123" "-12300" do not confuse me,
because they are not what I want.

> > I feel doing evil if I'm adding more "rule of thumbs" to C++ since it
> > already has too many.
> Well... see above. Because you get that rule whether or not you keep
> align==internal.

I need no new rules, you use whatever that is

> (Come to think of it, I bet compilers could be taught to warn when you
> use a format that can't be round-tripped. But this would have to be an
> optional warning, because I'll be surprised if folks don't sometimes do

Not a part of std::format's design.

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

Received on 2019-06-26 11:01:46