[Python-Dev] Hundreds of warnings

Tim Peters tim.one@comcast.net
Wed, 15 May 2002 17:48:34 -0400


I suppose there's no need for pyport.h to define LONG_MIN or LONG_MAX
anymore, since C89 requires that limits.h define those.  LONG_BIT is an
extension to C89, but Python only uses LONG_BIT in two places now (it used
to use it more; I nuke these when I can), and those could easily enough be
rewritten; e.g., instead of

	if (b >= LONG_BIT)

we could do

	if (b >= 8 * SIZEOF_LONG)

Quite a while ago I added this to pyport.h, hoping to do that someday:

#if LONG_BIT != 8 * SIZEOF_LONG
/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent
 * 32-bit platforms using gcc.  We try to catch that here at compile-time
 * rather than waiting for integer multiplication to trigger bogus
 * overflows.
 */
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc
config?)."
#endif

[Note that integer multiplication no longer uses LONG_BIT.]

So if there's any platform on which LONG_BIT isn't redundant, nobody has
tried to compile Python on it since October of 2000.