Permalink
Browse files

printf behavior of %{..%}

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14833 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
gasche committed May 12, 2014
1 parent 7f8e43a commit 2da16025323bca2090e8478139104b4d4891db27
Showing with 6 additions and 4 deletions.
  1. +6 −4 stdlib/camlinternalFormat.ml
@@ -978,10 +978,12 @@ fun k o acc fmt -> match fmt with
| Char_literal (chr, rest) ->
make_printf k o (Acc_char (acc, chr)) rest
- | Format_arg (_, _, rest) ->
- (* Use the following code to obtain the old (curious?) semantics. *)
- (*fun _ -> make_printf k o (Acc_string (acc, string_of_fmtty fmtty)) rest*)
- fun (_, str) -> make_printf k o (Acc_string (acc, str)) rest
+ | Format_arg (_, sub_fmtty, rest) ->
+ if legacy_behavior then
+ let ty = string_of_fmtty sub_fmtty in
+ (fun _str ->
+ make_printf k o (Acc_string (acc, ty)) rest)
+ else (fun (_, str) -> make_printf k o (Acc_string (acc, str)) rest)
| Format_subst (_, _, fmtty, rest) ->
(* Call to type_format can't fail (raise Type_mismatch). *)
fun (fmt, _) -> make_printf k o acc

0 comments on commit 2da1602

Please sign in to comment.