On Feb 11, 2009, at 1:59 PM, Lisandro Dalcin wrote: > On Wed, Feb 11, 2009 at 6:37 PM, Robert Bradshaw > <[email protected]> wrote: >> >> I think the fix should be simple (I'll look at it later today, I'm >> off to catch the bus) but if not, lets roll it back. >> > > Robert, IMHO, the below code is wrong... > > c_size_t_type = CSizeTType(6, 1, "(sizeof(size_t) == > sizeof(unsigned long) ? T_ULONG : T_ULONGLONG)") > > what would happend if size_t is unsigned int, and sizeof(unsigend int) > < sizeof(unsigend long). You will end-up returning garbage...
Yes, this is the part that I said was a bit hacky, but I am almost sure that sizeof(size_t) = sizeof(int) < sizeof(long) is *really* rare. It would also break if, say, sizeof(long) < sizeof(size_t) < sizeof(long long) on some weird system with, say, a 43-bit size_t. I actually considered doing a nested if statement, but decided it wasn't worth it for now--if anyone on this list is using such a system speak up :). > As I said in previous mail, I believe the only sane way to fix this is > to use a property... This was exactly what I was thinking of doing, as well as some other changes/simplifications in there, as part of adapting complex numbers into the types framework. That's why I figured it wasn't worth putting lots of effort into it now, especially as I'd really like to push out a release soon. On that note, I've put up a temporary http:// hg.cython.org/cython-0.11/ which is for bugfixes only. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
