----- Original Message ----- From: "M.-A. Lemburg" <mal@lemburg.com> > 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 ! Care to explain? > 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). /No/ conforming compilers use the const-ness of a pointee passed to a function for optimization, since the pointer can be aliased by a non-const pointer. What it buys you, if you're a C++ programmer, is not having to litter your code with odious casts: PyObject_GetAttr(obj, const_cast<char*>("my_attribute")) -Dave
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4