On Mon, Aug 20, 2012 at 10:27 AM, David Matthews <[email protected]> wrote: > On 20/08/2012 15:28, Pierre-Alain Bourdil wrote: >> >> >> In ForeignTest, the vol2tree method use fromClong to differentiate >> between NullTree, or Tree. My union, is made of 2 variants : a struct >> pointer and a int64_t . I can't figure out how to decide if a given >> vol is a pointer or an int64_t. is there a solution ? The inverse >> conversion is pretty forward > > > It's difficult to know what to do if you can't tell whether you have a > number or the pointer to something. Are you actually returning these sort > of values from your C code to ML? If not you can just use a dummy function > that raises an exception in the conversion from a vol to the ML datatype. > > David
I suspect Pierre-Alain is implicitly assuming that somehow PolyML uses some form of low bits tag to differentiate whether an integer bit-pattern (e.g. a value of type intptr_t) is either a vol or an int64_t. I suspect the answer is no. _______________________________________________ polyml mailing list [email protected] http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
