Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C standard #42

Open
encukou opened this issue May 31, 2023 · 3 comments
Open

C standard #42

encukou opened this issue May 31, 2023 · 3 comments
Labels
evolution-proposed theme: the C language issues related to the way we use the C language

Comments

@encukou
Copy link
Contributor

encukou commented May 31, 2023

According to PEP 7 -- the style guide (!) -- public Python headers are compatible with C99 and (some version of) C++.
That is arguably not strict enough, and it's definitely untested.

See discussion in https://discuss.python.org/t/26481

@vstinner
Copy link
Contributor

vstinner commented Jun 8, 2023

In practice, I'm trying to keep it compatible with ISO C89, since some projects require explicitly C89, likely for historical reasons (maybe to detect build failures on old Visual Studio versions). I could fight to enforce C99 or C11, but in practice, it's cheap to fix the very low number of C89 issues. Usually, it's just about declaring variables at the top of static inline functions.

Also, if almost the whole API become just a list of declaration of opaque functions, the C standard is not really a big deal anymore (maybe just for <stdint.h> types, like int64_t, or ssize_t) :-)

Note: Recently, I started to care about the C++ standard as well, since Python C API is used in C++ (ex: pybind11) and converting macros to static inline functions created new funny issues.

@dgrunwald
Copy link

The inline keyword doesn't exist in C89, it's a new addition in C99.
Though many compilers already supported it earlier as a language extension.

@iritkatriel iritkatriel added the theme: the C language issues related to the way we use the C language label Jul 13, 2023
@iritkatriel iritkatriel added the v label Jul 22, 2023
@iritkatriel iritkatriel removed the v label Oct 23, 2023
@encukou
Copy link
Contributor Author

encukou commented Oct 23, 2023

Proposed guideline issue: capi-workgroup/api-evolution#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evolution-proposed theme: the C language issues related to the way we use the C language
Projects
None yet
Development

No branches or pull requests

4 participants