English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] NULL as a caml value
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christopher Quinn <cq@h...>
Subject: Re: [Caml-list] NULL as a caml value
Jacques Garrigue wrote:
> From: Lauri Alanko <la@iki.fi>
> 
>>The docs weren't very clear on this, so I just wanted to check: is
>>(value)NULL a legal caml value? Checking from the sources, it seems that the
>>GC does leave alone all pointers that don't point to within the caml-managed
>>heap. However, the docs state that only "memory allocated by malloc" can be
>>turned directly into an abstract caml value. So may I rely on NULL working?
>>It would ease dealing with many C interfaces.
> 
> 
> Yes, NULL is valid, as are all word-aligned addresses outside of the
> Caml heap.

Does it even need to be word aligned?
If Is_long() tests positive the 'pointer' is also ignored.
I hope I have not erred!?

- chris

-------------------
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