[Python-Dev] Add const to python API (original) (raw)

Barry Scott barry at barrys-emacs.org
Mon Oct 19 22:39:06 CEST 2009


http://bugs.python.org/issue6952

Martin v. Löwis suggested that solutions to this issue should be
discussed here.

My goal is to avoid compiler warning and the need to cast to remove
const when calling the python API.

For example I see compiler messages like this on Mac OS X Snow Leopard
g++ reports:

example.cxx:633: warning: deprecated conversion from string constant
to ‘char*’

The patch I developed for comment only adds const to the input
parameters and used casts to allow output parameters to stay without the const.

This is because adding the const to the input params will not break
existing code, but adding const to output parameters may well require code changes for
users of the Python API.

What is the best approach to this problem that will be acceptable?

Barry

-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20091019/d7f6ae05/attachment.htm>



More information about the Python-Dev mailing list