C++ Logo

std-discussion

Advanced search

std::format: Can't use a flag for floating-point and get the default format

From: Rob Lefebvre <rob_lefebvre_at_[hidden]>
Date: Mon, 8 Feb 2021 13:58:20 +0000
Thanks, Thiago.

> Since the precision is useful for C coders too, can we approach WG14 and agree on the solution?

I think you're saying that having the "guaranteed round-trip" precision would be useful for C, so we should come up with something that is printf compatible. How about the letter "r" for "real" (or "round trip" or "robust") instead of "z"? (Honestly, I don't really care what letter it is, but having something mnemonic would be ideal.)


A main point here: A change/addition will probably only happen to std::format if there is perceived value for allowing the arguments to be strongly typed. If there were broad consensus that this is not important, than any proposed change would probably be dead on arrival.


Rob Lefebvre
Senior Software Architect, Keysight Technologies

Received on 2021-02-08 07:58:28