Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%( %) in Format module seems to be broken #5121

vicuna opened this issue Aug 3, 2010 · 2 comments

%( %) in Format module seems to be broken #5121

vicuna opened this issue Aug 3, 2010 · 2 comments


Copy link

@vicuna vicuna commented Aug 3, 2010

Original bug ID: 5121
Reporter: khooyp
Assigned to: @pierreweis
Status: closed (set by @xavierleroy on 2015-12-11T18:18:45Z)
Resolution: fixed
Priority: high
Severity: minor
Version: 3.11.2
Target version: 4.00.2+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @sliquister @hcarty

Bug description

Comparing the Printf module vs. the Format module:

Printf.printf "111 %(%d%) 222%!" "%d" 3;;

111 3 222- : unit = ()

Format.printf "111 %(%d%) 222%!" "%d" 3;;

111 - : unit =

This seems to happen if %( %) encloses any format specifier.

File attachments

Copy link

@vicuna vicuna commented Dec 27, 2011

Comment author: @sliquister

I attached a patch on the current head that solves the issue.
cont_m in Format.mkprintf was wrongly computing the indexes in the array of values.

Copy link

@vicuna vicuna commented Apr 24, 2013

Comment author: @pierreweis

Thanks again for the bug report and the patch. I did a big cleaning in the code to get rid of the bug, as well as suppress irrelevant differences between Printf and Format codes for function mk_printf.

I will add your example to the test suite for the module Format.

@vicuna vicuna closed this Dec 11, 2015
@vicuna vicuna added this to the 4.00.2 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants