Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 <>
>>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 Archives:
Bug reports: FAQ:
Beginner's list: