Skip to content

printf bugs

I think the following are bugs in printf:

Prelude Text.Printf> printf "%.*f" 2 (1/3) :: String
"*** Exception: Printf.printf: bad formatting char *
(expected: "0.33")

Prelude Text.Printf> printf "%.3s" "foobar" :: String
"foobar"
(expected: "foo")

This one may not be a bug but it's incompatible with C printf:

Prelude Text.Printf> printf "%10.5d" 4 :: String
"         4"
(expected: "     00004")
Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information