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

printf format strings type is wrong. #3902

Closed
vicuna opened this issue Dec 1, 2005 · 4 comments
Closed

printf format strings type is wrong. #3902

vicuna opened this issue Dec 1, 2005 · 4 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 1, 2005

Original bug ID: 3902
Reporter: vanicat
Assigned to: @pierreweis
Status: closed (set by @xavierleroy on 2006-05-06T07:53:07Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.09.0
Fixed in version: 3.09.0
Category: ~DO NOT USE (was: OCaml general)

Bug description

When trying the new printf format, I've the following, which is very very strange:

Printf.printf "%{%d%s%}" "kk%dkk%s\n" ;;

  • : unit =

let t = Obj.repr (Printf.printf "%{%d%s%}" "kk%dkk%s\n");;

Obj.is_block t;;

  • : bool = true

Obj.is_block (Obj.repr ());;

  • : bool = false

Obj.tag t;;

  • : int = 247

Obj.closure_tag;;

  • : int = 247

So it seem that Printf.printf "%{%d%s%}" "kk%dkk%s\n" should have a functional type, not unit.

@vicuna
Copy link
Author

vicuna commented Dec 1, 2005

Comment author: @oandrieu

It seems that the function Printf.nargs_of_format_type counts each %( %{ %) and %} as an argument ... which looks wrong. And in the case of %{, the internal % shouldn't be counted.

@vicuna
Copy link
Author

vicuna commented Dec 12, 2005

Comment author: @pierreweis

Due to bad interaction with the new semantics for printf, this issue will be corrected ASAP.

@vicuna
Copy link
Author

vicuna commented Jan 23, 2006

Comment author: @pierreweis

Bug fixed in sources 3.09.2+dev2 (2006-01-23).

@vicuna
Copy link
Author

vicuna commented May 6, 2006

Comment author: @xavierleroy

Appears fixed in 3.09.2. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants