[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] C_truep( C_fixnump( w ))
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] C_truep( C_fixnump( w )) |
Date: |
Mon, 25 Feb 2008 07:58:58 +0100 |
On Sun, Feb 24, 2008 at 8:15 PM, Jim Ursetto <address@hidden> wrote:
> On 2/24/08, Heinrich Taube <address@hidden> wrote:
> > im sure this must be something stupid but i dont understand why it
> > crashes if its not float data
>
>
> > C_word w = C_u_i_car( lyst );
> > if (C_truep( C_flonump( w ) )) {
>
>
> Heinrich,
>
> Try if (C_truep(C_blockp(w)) && C_truep(C_flonump(w))) {...}
> and see if it helps.
>
> Since you're doing this completely in C, you don't really
> have to convert to a scheme boolean either:
>
> if (!C_immediatep(w) && C_block_header(x) == C_FLONUM_TAG) { ... }
>
>
Right.
C_flonump does not check whether the argument is non-immediate
and fetches the header of the object pointed to. If the argument is
immediate it naturally will not point to a valid block.
This may appear as some kind of premature optimization, but doing
the check in the C_flonump macro would evaluate the argument
twice, and this might result in invalid behaviour in case the argument
is a ("direct") call to an optimized function.
cheers,
felix