On 15 April 2010 14:36, Robert Bradshaw <[email protected]> wrote:
> On Apr 15, 2010, at 7:59 AM, Lisandro Dalcin wrote:
>
>> I've already mailed about this, no one (other than Greg, of course)
>> commented... This patch fix and  add tests for the C rules of integral
>> promotions in some interesting corner cases. The algorithm is
>> basically the one available in latest Pyrex plus the handling of
>> complex types. As we already discussed with Greg, this algorithm is
>> not actually correct according to the wording of the C99 standard (and
>> common sense), because type promotion do depends on the actual type
>> sizes. But Greg's implementation is IMHO the best we can do from
>> Pyrex/Cython side.
>>
>> If no one complains, I'll push the patch.
>
> I'm fine with it. Basically, you're assuming that the rankings are
> strict, whereas the former code assumed that it was not.

Yes, I'm assuming all types have different sizes. And no, the former
code actually assumed that: For all signed T1+ unsigned T2 -> unsigned
max(T1,T2), and that's not right, think of T1=longlong and T2=char,
the result should be signed.

> Unfortunately, most of the places this will come up is int < long =
> long long or int = long < long long, but there's not really a way to
> do better.
>

Yep, but only when mixing signed+unsigned and
rank(signed)>rank(unsigned) . I would be nice to genetate Cython
compile warnings in this case...


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to