Commits

Kota UENISHI committed 0e3d108

integer in ocaml internal is, (x << 1) is a valid memory data as seen: severe bug.

Comments (0)

Files changed (3)

   v_res = caml_alloc(i, 0);
   while (--i >= 0) {
     v_ev = caml_alloc_small(2,0); 
-    Field(v_ev, 0) = i;
-    Field(v_ev, 1) = caml_copy_int32( 23 );
-    printf("len=%d : %p\n", i, v_ev);
+    Field(v_ev, 0) = i << 1;
+    Field(v_ev, 1) = 23 << 1;
+    printf("putting (%d,%d)\n", i, 23);
     Store_field(v_res, i, v_ev);
   }
   POUT;
 external hello : string -> unit = "hello"
 external env : unit -> string = "env"
 
-external hoge : unit -> (int * int) list = "hoge"
+external hoge : unit -> (int * int) array = "hoge"
 
 let _ =
   hello "hoge";
-  List.iter (fun (i,j) -> Printf.printf "(%d,%d)\n" i j) ((3,4)::(hoge()));
+  let l = Array.to_list (hoge()) in
+  List.iter (fun (i,j) -> Printf.printf "(%d,%d)\n" i j) l;
   Pervasives.print_string "Hello World!\n";;
   
 val hello : string -> unit
 val env : unit -> string
-val hoge : unit -> (int * int) list
+val hoge : unit -> (int * int) array
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.