[Python-Dev] Re: [Python-checkins] python/dist/src/Include compile.h,2.38,2.39 parsetok.h,2.19,2.20 pyerrors.h,2.63,2.64 pythonrun.h,2.55,2.56 symtable.h,2.10,2.11

Tim Peters tim@zope.com
Wed, 11 Dec 2002 12:01:32 -0500


[M.-A. Lemburg, on constification]
> I remember Tim opposing such changes (and Greg Stein insisting
> on them ;-). AFAIK, this breaks third party code since some
> compilers simply reject casting char* to const char*.

A non-broken compiler always allowd passing a

    T

actual argument to a

    const T

formal argument, so I never object to those, and indeed I sneak const into
prototype arglists whenever it's convenient.

That's a different issue than making all of Python "const correct", which
has been a near boundlessly low bang-for-the-buck effort in every project
I've seen undertake it.  Try passing a

    const T*

actual argument to a

    T*

formal argument and a non-broken compiler will complain, and then either
casts have to proliferate, or consts have to proliferate, to stop the
errors.  Sometimes this is called "const poisoning", at least by objective
observers <wink>.