Fix printing of arrays in C code
It should be f(int a[5]) instead of f(int *a) because the second one does not scale for multidimensional arrays, eg g(int b[10][5]) is ok but g(int **b) is not.
This commit is contained in:
parent
1d8f2f2a85
commit
2956e6feb4
1 changed files with 1 additions and 4 deletions
|
@ -191,10 +191,7 @@ let rec pp_vardecl fmt (s, cty) = match cty with
|
|||
let ty, indices = pp_array_decl cty in
|
||||
fprintf fmt "%a %a%s" pp_cty ty pp_string s indices
|
||||
| _ -> fprintf fmt "%a %a" pp_cty cty pp_string s
|
||||
and pp_paramdecl fmt (s, cty) = match cty with
|
||||
| Cty_arr (n, cty') -> fprintf fmt "%a* %a" pp_param_cty cty' pp_string s
|
||||
| _ -> pp_vardecl fmt (s, cty)
|
||||
and pp_param_list fmt l = pp_list1 pp_paramdecl "," fmt l
|
||||
and pp_param_list fmt l = pp_list1 pp_vardecl "," fmt l
|
||||
and pp_var_list fmt l = pp_list pp_vardecl ";" fmt l
|
||||
|
||||
let rec pp_cblock fmt cb =
|
||||
|
|
Loading…
Reference in a new issue