[Python-Dev] Optimization of the Year (original) (raw)
Guido van Rossum guido at python.org
Wed Feb 11 12:58:26 EST 2004
- Previous message: [Python-Dev] Optimization of the Year
- Next message: [Python-Dev] Optimization of the Year
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote: > I'm all for this. I imagine there are many subtleties though -- I > know I consciously chose 'int' for this purpose in Python 0, and the > assumption that it fits in an int is everywhere. I would trust a > decent compiler to find most cases, but not all.
[MvL]
The MS Win64 compiler (Itanium) is pretty good at finding sizet/int conversions, as sizet is wider even than long on the system. I have patches sitting on my disk to change all function signatures, but not the structure layouts. They are (unfortunately) still incomplete, and it is doubtful whether I can complete them before PyCon.
Maybe it can be a sprint topic?
> Also, occasionally (sizet)(-1) may be used to indicate an error > (e.g. PySequenceSize()).
This is the tricky part that I want to defer in the first round of patches: I believe obsize should be a signed type, so it should be ssizet where available. The tricky part is finding an appropriate type on systems where ssizet is not available.
Why not simply use Py_intptr_t then?
(sizet)(-1) is not a problem per se; this is well-defined on all ISO C compilers. However, some code may expect that the error marker is smaller than any other value, which would not be the case for (sizet)(-1).
Right, that's what I meant.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Optimization of the Year
- Next message: [Python-Dev] Optimization of the Year
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]