From jan@swi.psy.uva.nl  Thu Feb 10 09:57:29 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id JAA25090;
	Thu, 10 Feb 2000 09:57:29 +0100 (MET)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id JAA01710;
	Thu, 10 Feb 2000 09:57:49 +0100
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Paul Singleton <p.singleton@keele.ac.uk>,
        SWI Prolog <prolog@swi.psy.uva.nl>
Subject: Re: pointers as integers
Date: Thu, 10 Feb 2000 09:53:36 +0100
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <38A1F268.52BC2A0@keele.ac.uk>
In-Reply-To: <38A1F268.52BC2A0@keele.ac.uk>
MIME-Version: 1.0
Message-Id: <00021009574900.01684@gollem>
Content-Transfer-Encoding: 8bit

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

