eyalroz / printf

Tiny, fast(ish), self-contained, fully loaded printf, sprinf etc. implementation; particularly useful in embedded systems.
MIT License
402 stars 50 forks source link

"Support" negative precision values #183

Open eyalroz opened 1 month ago

eyalroz commented 1 month ago

Apparently, the C99 standard dictates that:

A negative precision argument is taken as if the precision were omitted

and while not entirely explicit about this regarding in-format-string precision, rather than separate-argument precision - that is the reasonable interpretation. So, we need to parse negative precision values... :-P

In C17, this was changed, so that the precision must be a non-negative value (which makes negative-precision values unsupported syntax and thus we can do what we want with them).