chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] return a pair of ints from a C function?


From: felix winkelmann
Subject: Re: [Chicken-users] return a pair of ints from a C function?
Date: Fri, 1 Aug 2008 00:59:02 +0200

On Fri, Aug 1, 2008 at 12:11 AM, Shawn Rutledge
<address@hidden> wrote:
> On Thu, Jul 31, 2008 at 1:39 PM, felix winkelmann <address@hidden> wrote:
>> The C_alloc is a macro that actually does alloca(), so you are allocating
>> stack data that is not live after returning from the function. You will
>
> Hmm, I thought C_return made that OK, because it's normal for objects
> to live on the stack.  But you are saying that's only true if I use
> foreign-primitive?

C_return does other things but does not save live data from the stack
to the heap.

>
>> either have to use `foreign-primitive`(to create a CPS function), or
>
> Why don't you prefer that approach?

Well, the pass-the-box approach appeared simpler, but foreign-primitive
is probably the cleaner approach and doesn't require you to create
a wrapper function.


cheers,
felix




reply via email to

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