Dag Sverre Seljebotn, 07.12.2009 21:17:
> I'm not against "bint" always being 0 or 1 in general though, so that
>
> cdef bint x = 3
>
> turns into
>
> cdef bint x = (3 != 0)
>
> and
>
> cdef extern bint foo()
> x = foo()
>
> turns into
>
> __pyx_v_x = (foo() != 0);
Actually, that's not even required. All you'd have to take care of is that
bint becomes 0/1 when coercing to a non-bint type. That could simply
include other int types in the future, so that
cdef int i = 0
cdef bint x = 5
i = x
would be guaranteed to set i to 1, whereas x would still be 5.
I'm not sure how this would apply to comparisons, though, such as
cdef bint x = 5
cdef int i = 5
cdef bint result = i == x
print result
should that print False (being evaluated as 'int'), or would the comparison
use the bint type and return True?
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev