Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Looking for a real array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Karl Zilles <zilles@1...>
Subject: Re: [Caml-list] Looking for a real array
Eray Ozkural wrote:

 > On Monday 28 April 2003 21:43, Brian Hurt wrote:
 >
 >> I may be confused, but I thought integers were unboxed in arrays (not
 >> BigArrays, just arrays).  Unless you mean references to integers?
 >>
 >
 >
 > Okay, I might be a little confused, forgive me. I thought, 
implementation wise, when I say
 > let a = [| 6, 3, 5, 7, 8 |]
 > it's implemented by ocaml as
 > int** a;
 > in C speak.
 >
 > Right or wrong? (Fearing that I might be demoted to beginner status 
now :P )
 >

In the "Interfacing with C" section of the manual:

---
18.3.3     Arrays

Arrays of integers and pointers are represented like tuples, that is, as 
pointers to blocks tagged 0. They are accessed with the Field macro for 
reading and the modify function for writing.

Arrays of floating-point numbers (type float array) have a special, 
unboxed, more efficient representation. These arrays are represented by 
pointers to blocks with tag Double_array_tag. They should be accessed 
with the Double_field and Store_double_field macros.
---

So it looks like the standard ocaml 31 bit integers arrays are unboxed, 
as are floats arrays.



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners