On Thu, Feb 19, 2009 at 6:22 AM, Robert Bradshaw <[email protected]> wrote: > I think it makes sense to include these as basic_c_type_names, the > same as long and char. However, I'm not to particular on the > implementation. They should not be able to accept modifiers.
Well, if Py_ssize_t and size_t are listed in basic_c_types_names, I cannot see a simple way to make the parser reject a modifier. That's the reason I want to treat them in a slightly special fashion. BTW, did you mean 'int' instead of 'long'? AFAIK, 'long' is actually 'signed long int'. > In terms of the behavior for code below, I agree an warning should be > emitted and the ctypedef ignored. > Then I'll try to make this work, but this would still need to special-case when parsing basic C types. If not, the mix of <modifiers> <Py_ssize_t | size_t> get consumed and a the ctypedef parsing will fail because of a empty typedef name (the same if you wrote "typedef double" instead of "typedef double MyDouble"). Just a question: if the ctypedef is ignored, what should be the return of p_ctypedef_statement() ??? None? a PassNode? > - Robert > > > On Feb 18, 2009, at 12:39 PM, Lisandro Dalcin wrote: > >> Supose this fragment: >> >> cdef extern from *: >> ctypedef long Py_ssize_t >> ctypedef unsigned long size_t >> >> With this patch, these ctypedef's seems to be just ignored. This is >> good for the sake of Cython-backward and Pyrex compatibility. However, >> it would be nice to make Cython generate a warning. But the right >> place to do that is not at the point of parsing basic C types, but on >> parsing a ctypedef statement itself. >> >> >> >> -- >> Lisandro Dalcín >> --------------- >> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) >> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) >> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) >> PTLC - Güemes 3450, (3000) Santa Fe, Argentina >> Tel/Fax: +54-(0) >> 342-451.1594<SPECIAL_C_TYPES.diff>____________________________________ >> ___________ >> Cython-dev mailing list >> [email protected] >> http://codespeak.net/mailman/listinfo/cython-dev > > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
