[Cython] a problem with sizeof() return type
Michael Abshoff
michael.abshoff at googlemail.com
Wed Feb 4 15:40:10 CET 2009
Dag Sverre Seljebotn wrote:
> Lisandro Dalcin wrote:
>> 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?
>
> The objections as I understand them is that not all C compilers
> understand the "size_t" type. Not all projects (amongst them CPython)
> adhere to the latest C standards.
>
Well, an arguing that those damn C compilers ought to be fixed to follow
the C standard also is unrealistic. Note that one such broken compiler
which needs help to understand what a size_t is even in C++ mode is VC6
which is Python 2.3's official compiler on Windows, so not supporting it
would be a bad move as long as Cython claims to support Python 2.3. And
some people have reported bugs in Cython with Python 2.3 and VC6 in the
last couple months, so it is still being used. That is sad since VC6
leaves much to be desired, but we live in a world of legacy code :)
Cheers,
Michael
More information about the Cython-dev
mailing list