Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004204OCamlOCaml generalpublic2007-02-13 13:462008-09-11 13:58
Reporterdra 
Assigned Toweis 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.09.3 
Target VersionFixed in Version3.11+dev 
Summary0004204: Positional specifiers in Printf don't appear to work
DescriptionPositional specifiers do not work as indicated in the documentation for Printf. Specifically, the example given "For instance, %.*3$f prints a float with as many fractional digits as the value of the third argument." gives the following response in the toploop:

# Printf.printf "%.*3$f";;
Characters 14-22:
  Printf.printf "%.*3$f";;

rather than int -> float -> unit!
Additional InformationI'm assuming that this is a code bug rather than a docs bug if Printf aims to be POSIX compliant.
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0003992closedweis Printf: positional specifiers do not work 

-  Notes
(0003915)
dra (reporter)
2007-02-13 15:38

Oops --- bottom two lines of the toploop transcript are missing. It should have read:

# Printf.printf "%.*3$f";;
Characters 14-22:
  Printf.printf "%.*3$f";;
                ^^^^^^^^
Bad conversion %3, at char number 0 in format string ``%.*3$f''
(0004015)
weis (developer)
2007-04-16 00:59

This a bug in the type-checking of format strings. This is not so easy to fix, and need a rather drastic modification of the routine that type-checks format strings. This is on the TODO list for the next version.

In the mean time, a quick fix could be to suppress positional specifiers from the documentation of format strings :)
(0004609)
doligez (administrator)
2008-09-11 13:58

fixed by removing positional specifiers from the doc (for the time being)

- Issue History
Date Modified Username Field Change
2007-02-13 13:46 dra New Issue
2007-02-13 15:38 dra Note Added: 0003915
2007-04-16 00:59 weis Note Added: 0004015
2007-04-16 00:59 weis Assigned To => weis
2007-04-16 00:59 weis Status new => confirmed
2007-05-25 09:45 weis Relationship added has duplicate 0004290
2008-09-11 13:49 doligez Relationship deleted has duplicate 0004290
2008-09-11 13:49 doligez Relationship added duplicate of 0003992
2008-09-11 13:58 doligez Note Added: 0004609
2008-09-11 13:58 doligez Status confirmed => closed
2008-09-11 13:58 doligez Resolution open => fixed
2008-09-11 13:58 doligez Fixed in Version => 3.11+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker