[mercury-users] Tabling c_pointer values

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Apr 6 02:32:42 AEST 2011


On Tue, 5 Apr 2011, Peter Wang wrote:

> On 2011-04-04, Michael Day <mikeday at yeslogic.com> wrote:
>> Hi,
>>
>> It would be nice to be able to table c_pointer values; currently
>> this can be achieved by converting them to int and back, but this
>> seems unnecessarily circuitous.
>
> Hi Michael,
>
> This is possible using the optional tabling attributes.
> e.g.
>
>    :- pragma memo(p/2, [fast_loose]).
> or
>    :- pragma memo(p/2, [specified([addr, output])]).

In general, except for the use of fast-loose memoing as above, foreign
types and c_pointers cannot be tabled unless certain assertions are made
by the programmer.  For foreign types, setting the attributes
"can_pass_as_mercury_type" and "stable" will allow tabling of those
values**.  There is no stable_c_pointer type available and it is unlikely
we will ever add it, as the c_pointer type will gradually be deprecated
in favour of foreign types.

Julien.

** the tabling section of the reference manual should have a pointer
back to the foreign types section that discusses these attributes.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list