Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Patrick Goldbronn - SYSCO <patrick.goldbronn@cea.fr>
To: "Inria, caml" <caml-list@inria.fr>
Subject: le GC et les bidouilles en C
Date: Thu, 05 Aug 1999 08:58:08 +0000	[thread overview]
Message-ID: <37A95220.860BAB48@cea.fr> (raw)

Bonjour,

Je me pose une question sur les manipulations des structures caml en C

Je déclare un type record :
------------------
type toto = {
	un : float array ;
	deux : int ;
} ;;
------------------

Je déclare une variable de type toto :
------------------
let mytoto = {
	un = Array.create 10 0. ;
	deux = 0 ;
} in
------------------

J'appelle une fonction C bidouilleC qui modifie le contenu de mytoto:
------------------
bidouilleC mytoto ;;
------------------


Le code C de bidouilleC :
------------------
un_v = Field(mytoto_v,0) ;

for (i=0,i<10;i++) 
  Store_double_field(un_v,i,Val_int(i)) ;
(* ca c'est bon je suppose, en fait on peut le faire avec n'importe quel
tableau avec la fonction modify *)
------------------

Le probleme est avec deux !
On doit faire, je suppose :
modify(&Field(mytoto_v,1),Val_int(1)) ;

Il n'y a pas besoin de declarer "deux" mutable ?

Est-ce que l'on peut utiliser cette méthode sur tous les types record et
tuple qui ont le tag 0 meme si les veleurs ne sont pas mutables (je
parle d'un point de vu technique, pas philosophique) ?

Merci pour votre aide.

-- 
#####################################
# Patrick GOLDBRONN                 #
# CEA - DRN/DMT/SYSCO               #
# CE-Saclay, Bâtiment 460           #
# 91191 GIF/YVETTE CEDEX (FRANCE)   #
#                                   #
# Tél : 01 69 08 40 66              #
# Fax : 01 69 08 96 96              #
#####################################




             reply	other threads:[~1999-08-12 10:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-05  8:58 Patrick Goldbronn - SYSCO [this message]
1999-08-20 15:57 Damien Doligez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37A95220.860BAB48@cea.fr \
    --to=patrick.goldbronn@cea.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox