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: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] NULL as a caml value
From: Christopher Quinn <cq@htec.demon.co.uk>

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

Sure, then this is only an integer, and the GC does not follow integers.
Someone even suggested that you can avoid the strange scenario I
described in my previous mail by "marking" pointers, that is or-ing
them with 1. If they are word aligned, then you can easily recover the
original.

Otherwise, looking at the runtime's source, I see nothing that would
prevent from using any (even non-aligned) pointer outside of the caml
heaps to be cast to a value, but the manual does not allow it
explicitly, so this may mean that such non-aligned even values could
be used for something else. (Actually they are already used for
compaction.)

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