Well, then how should we fix the return type in the code below ? (at
Cython/Compiler/ExprNodes.py)

class SizeofNode(ExprNode):
    #  Abstract base class for sizeof(x) expression nodes.

    type = PyrexTypes.c_int_type


I still think that the only sane way to fix that is to make Cython
understand 'size_t' as a already defined C type. That would let us to
properly define the return type of sizeof. Furthermore, that would let
users to forget about having to typedef ssize_t to something.

There are strong objections for my approach? What could be the
potential problems?


On Tue, Feb 3, 2009 at 9:30 PM, Dag Sverre Seljebotn
<[email protected]> wrote:
> Michael Abshoff wrote:
>> Jason Evans wrote:
>>>      cdef extern from "sys/types.h":
>>>          ctypedef unsigned long size_t
>>
>>
>> Well, make it unsigned long long on 64 bit Windows and it ought to work
>> nearly everywhere. I am not aware of any LLP64 bit OS that Cython
>> supports besides 64 bit Windows. Obviously there is no sys/types.h on
>> Windows, but that is a different story :)
>
> Just a slightly related note:
>
> Note that with this kind of declaration, all Cython uses in 90% of the
> situations is the fact that it is an unsigned integral type. "unsigned
> char size_t" it will do the same in almost all situations -- in the end,
> "size_t" is simply emitted to the .c file.
>
> The 10% is overflow exceptions from coercion from Python integer -- and
> pushing that decision too to the C compiler is on my personal todo-list
> (though far down). In general Cython prefers to leave knowledge of the
> size/capacity of types to the C compiler.
>
> --
> Dag Sverre
> _______________________________________________
> 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

Reply via email to