Subject: Re: pointers as integers

From: Jan Wielemaker <[email-masked]>
Date: Thu, 10 Feb 2000 09:53:36 +0100

On Thu, 10 Feb 2000, Paul Singleton wrote:
>Is this true in 3.3?
>
> "In the current system, pointers are represented by Prolog integers,
> but need some manipulation to make sure they do not get truncated due
> to the limited Prolog integer range. PL_put_pointer()/PL_get_pointer()
> guarantees pointers in the range of malloc() are handled without
> truncating.
>
>I've had no problems with Win32 versions; should I nevertheless use
>PL_***_pointer() for portability?

This is no longer true (as quite some limitations mentioned in the
manual :-).  It is nevertheless a good idea though.  In the current
version, these routines fiddle with bits, so that they are each reverse
and fully transparent upto the size of a long (which must be able to
hold a pointer according to the C-standard). 

The mangling however is designed such that common addresses are normally
mapped to tagged integers, rather then the more expensive indirect
integers.

Besides, it is always possible there will be a separate pointer type
someday, and why not use the interface for it already?

	--- Jan