Dag Sverre wrote:
> What one could do is:
>
> short temp_short
> int temp_int
> long long temp_longlong
> switch (sizeof(footype)) {
> case sizeof(short): temp_short = ....
> case sizeof(int): temp_short = ....
> case sizeof(long long): temp_short = ....
> }
> ....
> result... = ((sizeof(footype) == sizeof(short) ? temp_short : ...)
Consider that proof that it is still 06 in the morning here...
The idea holds, but what one must do is make comparisons between types
(sizeof(footype) > sizeof(bartype)?) to select between two alternative
temps.
The problem is then when that is used in another expression with a third
external typedef, which would lead to three possibilities for the temp,
and so on (in practice I can't see the number of external typedefs used in
any expression to go above four or five so it's not horrible).
Again, I don't like it, but it shows that there is a way.
But I should probably use my Cython time for more worthy goals and just
tell people that "if you don't know the size of an external typedef,
declare it at the widest possible type it can be" for now. People can't
then use overflowing behaviour for external typedefs, which seem OK.
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev