chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Returning a value from foreign-lambda*


From: Zbigniew
Subject: Re: [Chicken-users] Returning a value from foreign-lambda*
Date: Tue, 28 Aug 2007 10:36:51 -0500

This is strange.  What it used to say, at some point, was that the
argument to return had to be wrapped in parentheses, i.e. return(x).
That's because return() itself is a macro which does all the proper
cleanup and calls the current continuation.  C_return() is just an
alias to the return() macro, and as you probably noticed, 99% of
existing code uses return().  However, C_return() will work as well.

I can only guess that the instruction to use C_return() was put in
there to force people to use the parens, to avoid the case where you
say 'return x' instead of 'return(x)'.

Perhaps someone else knows definitively why this was changed.

On 8/28/07, Will M Farr <address@hidden> wrote:
> Hello all,
>
> In my copy of chicken (SVN, revision 5752), the way to return an
> object at the end of a foreign-lambda* is by using return(obj).  The
> wiki manual, however, says that I should use C_return(obj), as in
>
> (define my-strlen
>    (foreign-lambda* int ((c-string str))
>      "int n = 0;
>       while(*(str++)) ++n;
>       C_return(n);") )
>
> Which of these is the canonical one?  I'd be happy to change one of
> them (foreign-lambda* macro or wiki) to match the other.
>
> Thanks,
> Will
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>




reply via email to

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