caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Double+Int Records (C-Interface) and Double_array_tag
@ 2006-01-19 10:24 Bauer, Christoph
  2006-01-19 10:59 ` [Caml-list] " Frederic van der Plancke
  2006-01-19 11:25 ` Richard Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Bauer, Christoph @ 2006-01-19 10:24 UTC (permalink / raw)
  To: caml-list

Hi,

given a type like

type t = {
   i : int;
   f0 : float;
   f1 : float;
   ...
   f100 : float;
}

A value from this type is constructed in C-code. Is
it possible to create a block with a Double_array_tag?
(Because there are only unboxed values in this record.)

Thanks,


Christoph Bauer
Dipl. Inf.

LMS Deutschland GmbH
Luxemburgerstr. 7
D-67657 Kaiserslautern

T +49 631 303 22 152

mailto:Christoph.Bauer@lms-gmbh.de
http://www.lmsintl.com 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Double+Int Records (C-Interface) and Double_array_tag
  2006-01-19 10:24 Double+Int Records (C-Interface) and Double_array_tag Bauer, Christoph
@ 2006-01-19 10:59 ` Frederic van der Plancke
  2006-01-19 11:25 ` Richard Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic van der Plancke @ 2006-01-19 10:59 UTC (permalink / raw)
  To: caml-list



"Bauer, Christoph" wrote:
> 
> Hi,
> 
> given a type like
> 
> type t = {
>    i : int;
>    f0 : float;
>    f1 : float;
>    ...
>    f100 : float;
> }
> 
> A value from this type is constructed in C-code. Is
> it possible to create a block with a Double_array_tag?
> (Because there are only unboxed values in this record.)

For what I know, all float values in this record are actually boxed because of the "int" field. Only records (and arrays) that contain only floats have their floats unboxed.

Frédéric


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Double+Int Records (C-Interface) and Double_array_tag
  2006-01-19 10:24 Double+Int Records (C-Interface) and Double_array_tag Bauer, Christoph
  2006-01-19 10:59 ` [Caml-list] " Frederic van der Plancke
@ 2006-01-19 11:25 ` Richard Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2006-01-19 11:25 UTC (permalink / raw)
  To: Bauer, Christoph; +Cc: caml-list

On Thu, Jan 19, 2006 at 11:24:54AM +0100, Bauer, Christoph wrote:
> given a type like
> 
> type t = {
>    i : int;
>    f0 : float;
>    f1 : float;
>    ...
>    f100 : float;
> }
> 
> A value from this type is constructed in C-code. Is
> it possible to create a block with a Double_array_tag?
> (Because there are only unboxed values in this record.)

On a 32 bit machine, the int is 4 bytes long and the floats are 8
bytes long, so the floats wouldn't be aligned.  How about simply:

type t = {
  i : int;
  f : float array;
}

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-19 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 10:24 Double+Int Records (C-Interface) and Double_array_tag Bauer, Christoph
2006-01-19 10:59 ` [Caml-list] " Frederic van der Plancke
2006-01-19 11:25 ` Richard Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).