[Python-Dev] PyString_GET_SIZE() (was: CVS: python/dist/src/Objects classobject.c,2.89,2.90 object.c,2.72,2.73)

Guido van Rossum guido@beopen.com
Wed, 28 Jun 2000 20:11:36 -0500


> > ! 	if (strlen(PyString_AS_STRING(v)) != (size_t)PyString_GET_SIZE(v))
> 
> Actually, it would seem to make more sense to place the cast *inside* the
> PyString_GET_SIZE() macro. That is the "true" semantic for GET_SIZE.
> 
> May as well start some ANSI-fication while we can...
> 
> Guido: any problem with my changing the macro?

Please leave the macro alone.  The type of the macro should be the
same as the type of the function -- PyString_Size() -- which is int.
If you change this, you potentially get tons of warnings because of
the signed / unsigned nature.

ANSI-fication is a good project for after 1.6.  But even then, it's a
separate decision whether the size of a string should be a size_t
instead of an int.  (The ob_size field should also change, if so --
with even more consequences.)

--Guido van Rossum (home page: http://www.python.org/~guido/)