I'd go with `{}`. You won't catch most formatting issues without testing anyway.
-
-
-
Also nit: {d} -> {:d} unless you mean named arguments.
- Još 1 odgovor
Novi razgovor -
-
-
IMO just support both. This is what we do in
#dlang and it's working great. You can do something quick and dirty when you need to or something strong and solid. There is no one size fit all for these kind of things. -
{fmt} already supports both, I was trying to ask what's best practice when using the formatting library.
- Još 1 odgovor
Novi razgovor -
-
-
I'd go with "{d}" if you only ever want integers, honestly. It's incomplete, but it let's you know if any assumptions are wrong immediately. Not a full replacement for tests, but you're enforcing an assumption.
-
It, IMO falls into the "catch errors as soon as possible" idea. Bonus if I use constexpr formatting and can catch it at compile time too.
- Još 1 odgovor
Novi razgovor -
-
-
When you say a_number is it decimals, or does it also include likes of fractions, irrational numbers, and complex numbers?
-
This particular case is only for integers
- Još 2 druga odgovora
Novi razgovor -
-
-
Also it doesn't enforce that it's a number. 'd' is a presentation specifier that integers understand but there can be other types that understand it too. Unlike in printf type safety is ensured by a different mechanism.
-
For example 'd' is valid for chrono types.
Kraj razgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.