[Python-Dev] Opinions on const-correctness?

Jack Jansen Jack.Jansen@oratrix.com
Tue, 12 Mar 2002 22:29:13 +0100


On dinsdag, maart 12, 2002, at 09:10 , Juergen Hermann wrote:

> Hi!
>
> When you interface const-correct C or C++ code with Python, you
> currently need to jump through hoops like this:
>
> somefunc(const char* modulename, const char* key)
> {
>     ... PyImport_ImportModule(const_cast<char*>(modulename)) ...
>
>
> I'd be willing to invest some time to change this, the question is:
>
>  1. someone opposed to such a change?
>
>  2. any technical reasons against it (const is ANSI, do we have a
> portability problem that cannot be solved by a #define)?

Even though Guido has sent in his -1 already ("Voting is futile. 
You have been assimilated." :-) I'll vote a +1 anyway.

Just this morning I stopped my self just in time from modifying 
a char * argument that could in some cases come from a 
StringObject, and that's definitely not the first time it 
happened to me:-)
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -