More damage to intuition (was RE: [Python-Dev] Comparison of recursive objects)

Thomas Wouters thomas@xs4all.net
Sun, 21 Jan 2001 22:54:05 +0100


On Sun, Jan 21, 2001 at 02:44:38PM -0500, Tim Peters wrote:

> > ! 	/* Same type name, or (more likely) incomparable numeric types */
> > ! 	return (v->ob_type < w->ob_type) ? -1 : 1;

> That's non-std C in a way Insure complains about elsewhere; change to

> 	return ((Py_uintptr_t)v->ob_type <
> 		  (Py_uintptr_t)w->ob_type) ? -1 : 1;

Why is comparing v->ob_type with w->ob_type illegal ? They're both pointers
to the same type, aren't they ?

> if-vendors-stuck-to-the-letter-of-the-c-std-python-wouldn't-
>      compile-at-all<wink>-ly y'rs  - tim

That's easy to check, gcc has these nice (and from a users point of view,
fairly useless) options: '-ansi', '-pedantic' and '-pedantic-errors'.
'-ansi' disables some GCC-specific features, -pedantic turns gcc into a
whiney pedantic I'm sure you'd get along with just fine <wink>, and
-pedantic-errors turns those whines into errors.

Doing a quick check I see one error I added myself (but haven't commited) in
the continue-inside-try patch (a trailing comma in an enumerator
definition), and one error in configure (it mis-detects the arguments to
setpgrp() in strict-ANSI mode, for some reason.) I don't see any errors in
the core Python. I see an error in the nis module (missing function
prototype, and broken system-include file) and a *lot* of errors in
linuxaudiodev, but nothing else in the set of modules I can compile. Not
bad!

Note that this was tested in a current tree. I couldn't find either Guido's
'broken' code or your proposed 'good' code, so I don't know if you checked
in a fix yet. If you didn't, don't bother, it's not broken :-)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!