[Pyrex] Declaring an unsigned char in Pyrex?
Francesc Altet
faltet at carabos.com
Sun Jun 3 12:48:34 UTC 2007
Hi,
I'm having problems declaring a *signed* char type in Pyrex. Normally,
a plain 'char' type should be enough for achieving this, but,
unfortunately, I know that there are some issues on certain platforms
(for example, PowerPC and GCC) where declaring such a plain 'char' is
equivalent to declaring an 'unsigned char'.
So, I declared in Pyrex the next:
ctypedef signed char int8
cdef extern from "idx-opt.h":
int bisect_left_b(int8 *a, long x, int hi, int offset)
[...]
def _searchBinNA_b(self, long item1, long item2):
cdef int8 *rbufrv, *rbufbc, *rbuflb
[...]
nchunk = bisect_left_b(rbufbc, item1, nbounds, 0)
and the gcc compiler compains in this way:
src/indexesExtension.c: In function
‘__pyx_f_16indexesExtension_10IndexArray__searchBinNA_b’:
src/indexesExtension.c:1873: warning: pointer targets in passing
argument 1 of ‘bisect_left_b’ differ in signedness
After looking at the sources, I see that Pyrex translates the 'signed
char' (int8 above) declaration to just 'char', i.e.:
char (*__pyx_v_rbufrv);
char (*__pyx_v_rbufbc);
char (*__pyx_v_rbuflb);
Shouldn't this be translated to 'unsigned char' types instead?
Thanks,
--
Francesc Altet | Be careful about using the following code --
Carabos Coop. V. | I've only proven that it works,
www.carabos.com | I haven't tested it. -- Donald Knuth
More information about the Pyrex
mailing list