Open encukou opened 1 year ago
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.
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.
Proposed guideline issue: https://github.com/capi-workgroup/api-evolution/issues/22
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