[Python-Dev] Opinions on const-correctness?

M.-A. Lemburg mal@lemburg.com
Tue, 12 Mar 2002 22:17:24 +0100


David Abrahams wrote:
> 
> > > The largest negative effect I can see is that it'll add some
> turbulence
> > > to the CVS log (many little changes).
> >
> > -1.
> >
> > I've never tried to enforce const-correctness before, but I've heard
> > enough horror stories about this.  The problem is that it breaks 3rd
> > party extensions left and right,
> 
> Only if you change the strings /returned/ by Python (or structure
> members) to const char*. Changing your parameters to const char* won't
> hurt anybody.

It doesn't hurt already compiled extensions, but it certainly 
breaks *all* yet to be compiled extensions ! 

Besides, it doesn't buy you much, since not all compilers use
the information for optimization (most I've seen only do careful 
checks of the implied read-only nature which can be very 
annoying).

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/