mpaland / printf

Tiny, fast, non-dependent and fully loaded printf implementation for embedded systems. Extensive test suite passing.
MIT License
2.54k stars 464 forks source link

printf_("%#.4o", 1) produces "00001", should produce "0001" #110

Open eyalroz opened 3 years ago

eyalroz commented 3 years ago

According to cppreference.com, and as implemented in glibc, the alternative mode for %o must ensure at least one leading zero is printed - but it doesn't increase the precision if a leading zero is already printed. Thus,

printf_("%#.4o", 1)

must produce "0001", not "00001". And yet - the latter is produced.