[Cython] long literal integers
Stefan Behnel
stefan_ml at behnel.de
Wed Jul 30 09:54:32 CEST 2008
Robert Bradshaw wrote:
> Currently there is no way to output literal C long, long long values,
> or unsigned long values. Also, large integer values used in a python
> context are truncated. It does, however, parse a trailing L to create
> a Python long.
>
> I propose that we update this to pass the trailing L (and LL) to the
> underlying C code, as well as accepting the unsigned suffix (also
> passed to C the code), and covert large integer literals into Python
> longs without truncating. This is slightly backwards incompatible, so
> I wanted to get people's feelings on this before making the change.
It may be incompatible, but it's definitely the expected behaviour. I
would consider code pretty much broken if it relies on truncated literals.
I think it's generally a good idea to have literals start off as C
literals and convert them at need (either at compile time or runtime).
This seems to apply here, too.
Stefan
More information about the Cython-dev
mailing list