[Cython] Boundchecking question
Robert Bradshaw
robertwb at math.washington.edu
Mon Aug 18 19:28:44 CEST 2008
On Sun, 17 Aug 2008, Carl Witty wrote:
> On Sun, Aug 17, 2008 at 1:11 AM, Robert Bradshaw
> <robertwb at math.washington.edu> wrote:
>> Constants will be optimized away. But if I write "i+1" where i is an
>> unsigned int, the result is still signed.
>
> Are you talking about Cython or C here? In C, if i is an unsigned
> int, then i+1 is also an unsigned int. If that's not the case in
> Cython, I think it should be changed to match C.
Ah, so in C, signed ints get promoted to unsigned ints. Interesting.
Cython should be fixed to reflect this, and this will make declaring
indices non-negative much easier (though I'm not going to do that until
next release as there may be unintended side effects).
- Robert
More information about the Cython-dev
mailing list