A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-December/147035.html below:

[Python-Dev] Constifying C API

[Python-Dev] Constifying C API [Python-Dev] Constifying C APIVictor Stinner victor.stinner at gmail.com
Mon Dec 19 05:29:33 EST 2016
2016-12-18 9:31 GMT+01:00 Serhiy Storchaka <storchaka at gmail.com>:
> Originally C API didn't use the const qualifier. Over few last years the
> const qualifier was added to C API if that preserved backward compatibility.
> For example input "char *" parameters were changed to "const char *". This
> makes C API compatible with C++, eliminates C compiler warnings, and helps
> to found possible errors.

Since the "const" keyword does not impact the stable *ABI*, I think
that it's fine to add use it in more places.

In the worst case, if an extension chose to be compiled with -Werror
(convert warnings into errors), the maintainer will have to fix
conversion warnings in the code. But it's easy to write C code which
works with and without const (old and new Python *API*), using
explicit cast (to const char* for example).

In the common case, it will just be a warning and nobody will notice
it since more and more people use pip which compiles C extensions in
the background and doesn't show GCC output anymore.

I agree that it can help to find real bugs.

Victor
More information about the Python-Dev mailing list

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