[Cython] Use of long type for intermediate integral variables

Ian Henriksen insertinterestingnamehere at gmail.com
Thu Jul 2 22:11:42 CEST 2015


On Thu, Jul 2, 2015 at 1:08 PM Robert McGibbon <rmcgibbo at gmail.com> wrote:

> Right, okay. I think I understand.
>
> -Robert
>
> On Thu, Jul 2, 2015 at 12:58 AM, Stefan Behnel <stefan_ml at behnel.de>
> wrote:
>
>> Robert McGibbon schrieb am 02.07.2015 um 09:49:
>> >> "libc.stdint.int64_t" is hand-wavingly declared as "long"
>> >
>> > There are some deeper issues in the rest of your message, but as a
>> > preliminary matter, isn't this a clear error for linux-32 and windows?
>>
>> No, it's not. That's just what Cython sees. The C compiler then sees the
>> exact platform specific type. And as the vast amount of Cython code out
>> there shows, it's usually not a problem in practice. Cython is designed to
>> handle most of these "platform specific type" issues at C compile time
>> rather than C code generation time. But as your example shows, it can't
>> always hide the details entirely. And there can be bugs.
>>
>> Stefan
>>
>> _______________________________________________
>> cython-devel mailing list
>> cython-devel at python.org
>> https://mail.python.org/mailman/listinfo/cython-devel
>>
>
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel


This is an interesting discussion. Thanks.
For the particular case of int64_t, wouldn't it still be wise to
make it a typedef of long long rather than just long so as to consistently
get the correct size on platforms where long
is only 32 bits?
Thanks!
-Ian Henriksen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20150702/d83c428f/attachment.html>


More information about the cython-devel mailing list