On Sun, Feb 24, 2008 at 8:15 PM, Jim Ursetto <[EMAIL PROTECTED]> wrote:
> On 2/24/08, Heinrich Taube <[EMAIL PROTECTED]> 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


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to