[Cython] better handling of numeric types

Stefan Behnel stefan_ml at behnel.de
Fri Feb 27 13:06:48 CET 2009



Lisandro Dalcin wrote:
> BTW, can I asume that if I write
> 
> if ( sizeof(c_type) < sizeof(long) ) {
> 
> } else if ( sizeof(c_type) == sizeof(long) ) {
> 
> } else {
> 
> }
> 
> then C compiler will be smart enough to eliminate the branching? (I
> know, I have to learn how to read disasemblies....)

Absolutely. The result of sizeof() is known at compile time and the C
compiler will only generate code for the first branch that evaluates to true.

Stefan



More information about the Cython-dev mailing list