Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Comparison of functional values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Comparison of functional values
> What I meant actually, was a «physical compare». I found out that 
> this (crude) C function works :
> 
> value phys_comp(value a, value b)
> {
>  if(a<b)
>    return Val_int(-1) ;
>  else if(a>b)
>    return Val_int(+1) ;
>  else 
>    return Val_int(0);
> }

No, it does not:  the GC can copy heap blocks and change the relative
ordering of their memory addresses.  You really need to pair your
functions with unique identifying integers.

- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr