Nathaniel Smith, 03.10.2013 14:35: > On Thu, Oct 3, 2013 at 1:23 PM, Stefan Behnel wrote: >> Greg Ewing, 03.10.2013 14:10: >>> Robert Bradshaw wrote: >>>> cdef int *a, b, c, *d[3] >>>> >>>> is IMHO quite ugly but also adds a lot of complexity to the parser. >>>> What if instead we required >>>> >>>> cdef int* a >>>> cdef int b, c >>>> cdef int[3]* d >> >> The last line looks ambiguous, BTW, hadn't even noticed it before. Is that >> an array of int pointers or a pointer to an array (pointer)? We should make >> sure the way this is declared is really obvious and not unexpected to C >> users. > [...] > The two halves of this email seem to sort of contradict each other, > don't you think? At least the C syntax has the advantage that it's > well-defined and many people *do* know it (and if they don't then > there are bazillions of references around, plus you can just copy it > out of header files if you're wrapping a C library), whereas as noted > above, in fact there are *no* people who know how to look at int[3]* > and be confident about what it means, even you...?
Well, it's still better than looking at "*d[3]", now, isn't it? Maybe I'm just confused (by both, actually) because I'm not really breathing C. If the following is what it's supposed to mean, then I find it quite straight forward, and more obvious than the C spelling: cdef int* a # pointer to int cdef int[3]* b # pointer to 3-item int array cdef int*[3] c # 3-item array of pointers to int I agree that the argument of "copying it out of a header file" has a certain value, although pointer declarations are not exactly the most common thing to find in header files. We shouldn't make it *harder* to copy things from header files, though, because it's already a drawback of Cython that you have to do that at all. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel