users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help to find an error


From: Fergus Henderson
Subject: Re: Help to find an error
Date: Mon, 22 Jan 2001 01:18:22 +1100

On 21-Jan-2001, zet <address@hidden> wrote:
> Hello.
> I'm trying to create xxx(-term) predicate.
> 
> I've write such a code:
> 
> Bool xxx(PlTerm z)
> {
>   PlTerm ter = Mk_Integer(1234);
>   z = ter;
>   return TRUE;
> }
> 
> After succesfull compile, I've started new executable and enter:
> xxx(Z).
> 
> Result was:
> Z = 0
> 
> Can somebody tell me Whats wrong?
> Thanks in advance.

In C, arguments are in general passed by value, not by reference.
So, presuming `PlTerm' is not an array type, the assignment to `z'
just assigns to the local copy.  It has no effect on the caller.
In fact the C compiler may well optimize the assignment away.

-- 
Fergus Henderson <address@hidden>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]