[m-rev.] For review: pretty print c_pointers as addresses

Ian MacLarty maclarty at csse.unimelb.edu.au
Wed Aug 16 12:16:39 AEST 2006


On Wed, Aug 16, 2006 at 10:56:14AM +1000, Mark Brown wrote:
> On 16-Aug-2006, Ian MacLarty <maclarty at csse.unimelb.edu.au> wrote:
> > On Tue, Aug 15, 2006 at 06:21:53PM +1000, Mark Brown wrote:
> > > On 15-Aug-2006, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
> > > > Mark Brown, Monday, 14 August 2006:
> > > > > On 14-Aug-2006, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
> > > > > > +
> > > > > > +% This really should be impure...
> > > > > > +%
> > > > > > +:- func c_pointer_addr(T) = int.
> > > > > > +
> > > > > > +:- pragma foreign_proc("C",
> > > > > > +    c_pointer_addr(X::in) = (Addr::out),
> > > > > > +    [promise_pure, will_not_call_mercury, will_not_modify_trail],
> > > > > > +"
> > > > > > +    Addr = (MR_Integer) X;
> > > > > > +").
> > > > > 
> > > > > If something really should be impure, then don't promise that it is pure.
> > > > > But why should this function be impure?
> > > 
> > > I've just realised that the argument to this function can be _any_ type,
> > > not just c_pointer.  In that case, yes, this function is impure (and poorly
> > > named, might I add).
> > > 
> > 
> > Why can't it be cc_multi, instead of impure?
> 
> Because it is a function.

I meant a cc_multi pred instead of an impure function.  Is there any
reason it can't be a cc_multi pred?

Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list