On Feb 25, 2008, at 5:55 AM, felix winkelmann wrote:
On Mon, Feb 25, 2008 at 1:28 PM, Heinrich Taube <[EMAIL PROTECTED]>
wrote:
thank you both very much. just to be sure:
(1) should i be using a C_truep() around C_immediatep() like the
other
predicate tests or is this ok:
if ( C_immediatep(w) ) {
if ( C_truep(C_fixnump(w)) ) {
...
}
else if ( C_truep(C_blockp(w)) && C_truep( C_flonump
( w ) )) {
Yes, this is correct. It is obviously inconsistent, but
C_immediatep was
intended to be used from C and C_fixnump from compiled code.
Changing this will break old (compiled) code.
I didn't bother to check for immediate or block since
1) We assume it is a Chicken numeric value
2) An immediate value is an invalid address of a block/special item
3) So checking 1st for a fixnum & then for flonum is enough
but real argument checking should be more stringent than my example.
(2) how can i test for strictly #f #t boolean value inside the
immedatep clause?
(x == C_SCHEME_FALSE || x == C_SCHEME_TRUE)
#define C_truep(x) ((x) != C_SCHEME_FALSE)
Most of the C_*p are wrapped in a C_mk_bool which is why I used
C_truep for the test.
cheers,
felix
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users
Best Wishes,
Kon
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users