<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/d346c56a895af1e7acafba888010f84d"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2006-02-13T09:45:25"
  subject="Re: [Caml-list] C interface style question"
  prev="2006/02/37d39060650086440a25f738a8d7ce2b"
  next="2006/02/be44d73f15618cb62a50293740a0e97e"
  prev-in-thread="2006/02/962385fdb164edd1ed6b71a33b90aec6"
  next-in-thread="2006/01/e7b42fa015233da439ea8381752144a3"
  prev-thread="2006/01/36aaa28f8a610df461cd41838dff2a3c"
  next-thread="2006/01/dd3c4505af44836e5904d9997aab0d9e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="C interface style question">
<msg 
  url="2006/01/d95e069e55697ffbd5bfd2b43dc9ec6f"
  from="Thomas Fischbacher &lt;Thomas.Fischbacher@P...&gt;"
  author="Thomas Fischbacher"
  date="2006-01-18T18:28:33"
  subject="C interface style question">
<msg 
  url="2006/01/ec4103913cc97b03dbc616a8131ab411"
  from="Gerd Stolpmann &lt;info@g...&gt;"
  author="Gerd Stolpmann"
  date="2006-01-18T19:18:19"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/00eee80fddf45046f944857209faffd5"
  from="Florent Monnier &lt;fmonnier@l...&gt;"
  author="Florent Monnier"
  date="2006-01-18T20:24:20"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/1323ce1ea39467d6d7be0b514c1541bd"
  from="Gerd Stolpmann &lt;info@g...&gt;"
  author="Gerd Stolpmann"
  date="2006-01-18T21:31:09"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/1cd9530d13e9ad5abfe68e8cdf25f0ef"
  from="Florent Monnier &lt;fmonnier@l...&gt;"
  author="Florent Monnier"
  date="2006-01-18T23:12:47"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/1ad7bee43eb78cb91ec000e9eb6ab3b7"
  from="Robert Roessler &lt;roessler@r...&gt;"
  author="Robert Roessler"
  date="2006-01-19T00:07:48"
  subject="Re: [Caml-list] C interface style question">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2006/01/70a71816df29b78ccbc20c9f41a34754"
  from="Jacques Garrigue &lt;garrigue@m...&gt;"
  author="Jacques Garrigue"
  date="2006-01-19T00:38:28"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/3b66654b5637672f592f341b8c2c6d77"
  from="skaller &lt;skaller@u...&gt;"
  author="skaller"
  date="2006-01-19T03:17:43"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/7811ef53b64e211284b6520300de7d77"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2006-01-19T14:09:00"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/1a6aec97d6ff701a0aa3a56f7cf6237c"
  from="Thomas Fischbacher &lt;Thomas.Fischbacher@P...&gt;"
  author="Thomas Fischbacher"
  date="2006-01-19T14:17:34"
  subject="Re: [Caml-list] C interface style question">
</msg>
<msg 
  url="2006/01/7ea9f4f55a50f3a997ade75e2bbe9008"
  from="Thomas Fischbacher &lt;Thomas.Fischbacher@P...&gt;"
  author="Thomas Fischbacher"
  date="2006-01-19T14:24:59"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/3ccfd582e9d3ecef281400eaace1a9f7"
  from="Olivier Andrieu &lt;oandrieu@n...&gt;"
  author="Olivier Andrieu"
  date="2006-01-19T14:53:00"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/a8a5a8a9ee7fd2b71cc74835c2f7b924"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2006-01-20T10:49:27"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/02/962385fdb164edd1ed6b71a33b90aec6"
  from="Olivier Andrieu &lt;oandrieu@n...&gt;"
  author="Olivier Andrieu"
  date="2006-02-12T20:40:34"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/02/d346c56a895af1e7acafba888010f84d"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2006-02-13T09:45:25"
  subject="Re: [Caml-list] C interface style question">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2006/01/e7b42fa015233da439ea8381752144a3"
  from="Thomas Fischbacher &lt;Thomas.Fischbacher@P...&gt;"
  author="Thomas Fischbacher"
  date="2006-01-19T15:15:19"
  subject="Re: [Caml-list] C interface style question">
</msg>
<msg 
  url="2006/01/0a655cea5a4df9a51acd73c898e41525"
  from="Thomas Fischbacher &lt;Thomas.Fischbacher@P...&gt;"
  author="Thomas Fischbacher"
  date="2006-01-30T13:12:42"
  subject="On Store_field()">
<msg 
  url="2006/01/674a9b2c80facff77a5118b448d41b46"
  from="Olivier Andrieu &lt;oandrieu@n...&gt;"
  author="Olivier Andrieu"
  date="2006-01-30T14:05:32"
  subject="Re: [Caml-list] On Store_field()">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2006/01/85633c91a5c3a30e200faa80bdd97520"
  from="Thomas Fischbacher &lt;Thomas.Fischbacher@P...&gt;"
  author="Thomas Fischbacher"
  date="2006-01-19T12:13:43"
  subject="Re: [Caml-list] C interface style question">
<msg 
  url="2006/01/663b3dcd51ed2c9256855f5f6e129a8b"
  from="Jacques Garrigue &lt;garrigue@m...&gt;"
  author="Jacques Garrigue"
  date="2006-01-19T13:49:36"
  subject="Re: [Caml-list] C interface style question">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>

On Feb 12, 2006, at 21:40, Olivier Andrieu wrote:

&gt;&gt; This is correct, except for the way you get the pointer.  You should
&gt;&gt; do it
&gt;&gt; properly with &amp;(Double_field(ml_array,0)).  There is no guarantee  
&gt;&gt; that
&gt;&gt; the value ml_array points to the first element of the array.

&gt; in mlvalues.h, I have (with ARCH_ALIGN_DOUBLE undefined) :
&gt;
&gt;   #define Double_val(v) (* (double *)(v))
&gt;   #define Double_field(v,i) Double_val((value)((double *)(v) + (i)))
&gt;
&gt; so &amp;(Double_field(ml_array, 0)) looks pretty equivalent to a simple
&gt; cast to double*, no ?

You should treat those definitions as abstract.  It is purely for
efficiency reasons that they are defined as macros.

If we decide to change the representation of Caml values (admittedly
a pretty remote possibility at this point), the pointer might not
point to the first field of the array anymore.  For example. it could
point to the header, or to the second byte of the contents.

-- Damien

</contents>

</message>

