[Python-Dev] Opinions on const-correctness? (original) (raw)

David Abrahams David Abrahams" <david.abrahams@rcn.com
Wed, 13 Mar 2002 08:31:50 -0500


As far as I can tell, there are maybe 3 standard library functions which might cause you to need to cast away const on an immutable buffer:

strtoimax strtoumax tmpnam

Am I missing something? Admittedly, I'm not intimately familiar with what the 'C' committee did to the library when they introduced const to the language.

-Dave ----- Original Message ----- From: "Martin v. Loewis" <martin@v.loewis.de> To: "David Abrahams" <david.abrahams@rcn.com> Cc: "Guido van Rossum" <guido@python.org>; <python-dev@python.org> Sent: Wednesday, March 13, 2002 2:12 AM Subject: Re: [Python-Dev] Opinions on const-correctness?

"David Abrahams" <david.abrahams@rcn.com> writes:

> 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 sure will. Inside the functions you change, you may not be able to use the argument as before. In particular, you may not be able to call functions from the standard C library anymore. Regards, Martin