[Patches] fix simple 64-bit warnings/errors in signalmodule.c and bufferobject.c

Tim Peters tim_one@email.msn.com
Tue, 6 Jun 2000 15:09:19 -0400

[Tim, rants about warnings]

[Trent Mick]
> <duck>There are a whole schwack of warnings that I am ignoring on
> the Win64 build. Basically I went through every one and, through
> code analysis, decided if it could be ignored or not.

And all of those you decided to ignore will appear forever more in the Win64
build, and everyone who comes after you (including you, 3 months from now
<0.5 wink>) will see them every time they build, so no later than the 3rd
build will stop looking at warnings entirely, and after that new and
dangerous warnings in new or changed code will simply get overlooked along
with the masses of old warnings.  That's fine for a project that never
leaves your machine, but, sorry, it's simply exceedingly bad practice for
group maintainability.

> These were mostly warnings of downcasts, for example
> 	int size = sizeof(Py_UNICODE);
> Which is *not* going to overflow but still generates a warning.

The "proper" fix here is to change the decl to size_t.  If keeping the decl
"int" is important, then the warning is thoroughly appropriate!  Casting
sizeof's result to int is a bad but expedient wormaround.  Defining a
SAFE_DOWNCAST macro (that checks that the downcast doesn't lose info in
DEBUG mode, and does the downcast without checking in non-DEBUG mode) is a
better (but still sucky) wormaround.  C is simply a pain in the ass here.

[on K&R style declarations failing to act as prototypes]
> ...
> Give the man a prize. That was it. We'll just forget that part of the
> patch then and thank you Tim for changing all function declarations
> from K&R to ANSI. :)

Believe it or not, I do intend to do that, although I expect resistance from
Guido <0.5 wink>.  Python's infrastructure is creaking from age, and an
update to ANSI C is l-o-n-g overdue.  It appears to me that a very large
part of your "Win64" efforts have amounted to fighting long-obsolete K&R C